Page 1 of 1

Animating Skins

Posted: 11 Mar 2015, 16:51
by Nigey
Hi Guys,

I've been trying to animate skins in the map editor on RollOver and RollOut. I've managed to connect the setup between AS3 and the OpenSpace map:

Code: Select all

trace("onSkinInteraction " + trigger + " trigger: " + evt.target + evt.currentTarget + evt.params.skin);


onSkinInteraction Trigger rollOver (target: 'enabledDoor'; params: '') trigger: [object OpenSpace][object OpenSpace][object door01]


And I see there's examples of how the skins can be played as MovieClips:

Code: Select all

else if (trigger.target == "rocking") // Make rocking chair rock
            {
               (skin as MovieClip).gotoAndPlay("rock")
            }


However where I'm struggling is how to activate the animation in Flash. Where do you create the animation in Flash for it to be played in the map? Is it an animation within the MovieClip in the library? Within a instance of a MovieClip in the scene? If you're able to use a tween inside a MovieClip in the library? How does it work?

Any help appreciated! I'm almost there!

Re: Animating Skins

Posted: 12 Mar 2015, 11:50
by Bax
I think exploring the rocking chair example is the best way to learn how to do it.
In the OpenSpace package open the Examples folder. In both subfolders it contains, you will find a zip file named Flex.zip. Open it and go to the /src/libraries folder, then open the furniture.fla file in Flash.
As you can see, it's stage is empty. Check the Library panel and open the RockingChair folder. Double click the RockingChair0 or RockingChair1 movieclip (which are the actual skins used by OpenSpace) and go to the Timeline panel.
As you can see it has two labels, one named "stop" and the other named "rock". Of course the first label is used to avoid the chair keep moving on the map. When the code calls

Code: Select all

(skin as MovieClip).gotoAndPlay("rock")

as you pointed out, it simply plays the movieclip, which contains all the required tweens.
Let me know if something is not clear.

Re: Animating Skins

Posted: 12 Mar 2015, 16:00
by Nigey
Working perfectly, cheers