Drag drop madness [FMX]need help please!

i’m not sure if anyone can help or turn me to the direction needed — but basically i’m trying to create an online brochure that users design with products/images they’ve selected. users will be able to drag a thumbnail to a pre-designed area, then swap them around to their liking. currently i’m in the beginning stages and just learning the power of actionscript.

i’ve attached two sample .fla files i’ve been working with. the first sample i have two thumbnails drag to a target and enlarge to a defined size. the second sample i used a tutorial from flashkit — drag drop swap. it works but the as is not up-to-date. i’m trying to incorporate the two ideas together but get bizarre effects. most of the examples i find are close but no cigar.

download .fla files :::

http://www.tykon.com/downloadzip.htm

thnx in advance

Wait lemme see if i understand…you want brochureTest5, but with updated coding right? If yes i’ll see if i can update it, but it looks really old :-\

EDIT: THen again, seems a bit tooooo old for me. Maybe i will have to try remaking the whole thing, i won’t guarantee i can do it though :-\

yeppyepp. brochureTest5 updated. i tried to create the same effect with brochureTest1, but it never wanted to work with the actionscript combination. so i then tried updating brochureTest5 with parts of the brochureTest1 code and my mind is still in circles. wild.

if you can help - kickazz!

Ok a quick quesiton, in brochure1, you have the pictures on the side. In brochure 5, the stuff are already inside the boxes. Which one do you want?! I’m still testing so i still may not be able to do this :-\

Edit: so far i’ve remade everything so the pics are on the side and you just drag em onto the boxes, but they’re restricted to only being allowed to be able to be dropped into the correct box. I made it just like how brochure1 was, and i tottally forgot about brochure5…

on the side.

when i changed this actionscript in the code:
[AS]
setProperty("/product" add count, _x, getProperty ("/target" add count, _x));
[/AS]

To:
[AS]
setProperty("/product" add count, _x, “/target”);
[/AS]

the images were off to the side where i wanted them, but more than one image was being dragged to a target.

Ok i changed the code so it was how brochure1 was downloaded. I made it so its much easier when you add more and more pics. Just change your code to this and see if its what you want…just havta change a bit of the starting point stuff though…

[AS]
stop();
var dropOkWidth = 200, dropOkHeight = 150, dropFailWidth = 100, dropFailHeight = 75;
var startX = 900;
var startY = 10;
_root.Product1._x = startX;
_root.Product1._y = startY;
_root.Product1.onPress = _root.Product2.onPress=function () {
this.startDrag(false);
};
_root.Product1.onRelease = function() {
this.targInstance = theTarget1;
this.stopDrag();
this.releaseCheck();
};
_root.Product2.onRelease = function() {
this.targInstance = theTarget2;
this.stopDrag();
this.releaseCheck();
};
MovieClip.prototype.releaseCheck = function() {
if (eval(this._droptarget) == this.targInstance) {
this._x = this.targInstance._x;
this._y = this.targInstance._y;
this._width = dropOkWidth;
this._height = dropOkHeight;
} else {
this._x = startX;
this._y = startY;
this._width = dropFailWidth;
this._height = dropFailHeight;
}
};
[/AS]

Is that what you want?

EDIT: and get off hide mode so i can see you’re online :stuck_out_tongue:

i understand the concept of adding more images to the code, a lot easier your way >`,-) but am confused with the starting point. tried to add another variable to Product2 so it would snap back to it’s original starting point rather than Product1 starting point. yeah, that didnt’ work my way!

not sure if i explained myself - my hair is blonde ^}{^
but i’m looking to get Product1 to drop on any of the 9 targets. then be able to swap Product1 with Product2 or Product5 with Product8 , etc… or have the product snap to it’s thumbnail size/position if it’s not dragged onto a target.

are if statements the way to go?
i tried to add the below if else if combo.

[AS]
_root.Product1.onRelease = function() {
if (this.targInstance = theTarget1){
this.stopDrag();
this.releaseCheck();
}
else if (this.targInstance = theTarget2) {
this.stopDrag();
this.releaseCheck();
}
};
[/AS]

maybe i’m going about this the wrong way! but there must be a way! thnx for your help so far.

and i did the EDIT! so you’ll c me if i’m on! :}

yea that could work. I’m thinkin you should do the startin point stuff last, since its not that important yet. The only thing about doin if/else statements, is that you will have like 100 lines for each product. This isn’t good…makes it very slow :-\ Maybe try making a function??

I’m also not too sure about swapping pictures, i’ll havta have a think, cause its pretty hard :-\

EDIT: oh yah, if you want it to be dropped anywhere, just take off the targInstance variable. And the image should just snap to size on any of the boxes