-
Binding objects
I need to temporary make an existing object an element of another one (not attaching from library). Any ideas how to do this?
Last edited by Tommyth; 11-29-2009 at 06:24 AM.
-
I hope I explained my problem well. Any help would be really appreciated, the problem is stopping my project from going on :/
-
Senior Member
I doubt I can help you but maybe you should explain your problem in more detail and be a lot clearer. It would make it much easier for someone who can help to do so.
-
Ok, so there is the problem in details:
I create a mc by attaching it to another mc. So when I find an item in game, I attach it to one small itemslot in my inventory. But I want to move these items around - so when I drag and put it to another itemslot, I want to make the item become an element of it and stop being element of previous one. If this is possible, I would like to avoid using attachMovie and duplicateMovie, as I think about possiblity of changing item variables in game(powering it up with gems or so).
What was my biggest problem - the item slots are in 4 groups - currently worn items, and 3 pages of backpack, and a backpack consists of group of itemslots. When I equip item, I would like to make it stop responding to commands which are given to backpack it was in before ( for example when I flip backpack's pages, I just make current one invisible and next one visible).
So, shortly:
I find item and put it in an empty slot. Then I pick it and put it on another one. I want to cancel any bond between the item and previous slot. Is this possible?
-
You need to make it so when the movieClip is stopped being dragged, it creates a bew variable called movieClip.attach_position to be the name of the closest box. Then onEnterFrame, make the movieClip move to movieClip.attach_position. Then you needx to make variable disappear when the movieClip is being pressed:
movieClip.onPress = function(){
movieClip.attach_position = movieClip;
startDrag(movieClip);
}
Hope this helps.
-
Thanks for response, but as far as I understand it won't solve the problem, cause when I call to _parent object it will still be the one I attached the movie on.
So maybe I will ask another thing. Is there any possibility to change _parent path to point other MC/level? If there isn't, maybe some of you have an idea how to replace it? I tried command setProperty, but it didn't work.
-
Instead of using _parent, it might be easier to use a direct path like _root.something.somethingwithinsomething.something svariable = whateveryouwant
-
My problem isn't about paths. I want to change _parent to make flash movie respond to commands given to object which is above in hierarchy:
Backpack1
|
ItemSlot1
|
Item
and then I Move the item out of backpack:
MainInventory
|
ItemSlotHand
|
Item
and cancel previous bond so it looks like:
Backpack1
|
ItemSlot1
|
null
Last edited by Tommyth; 12-07-2009 at 12:38 PM.
-
Oh, I don't know how you can do that. Maybe an addChild() function?
-
Probably, guess I will need to learn as3, cause I didn't found any solutions to this problem in as2 which I currently use :/
-
It is possible to do it in as2, you just need to think about the problem in a different way. Maybe instead of making one movieClip inside of another, you change variables to make it appear like it is within the backpack slots.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|