Animating Skins

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

Nigey
Posts: 35
Joined: 17 Dec 2014, 21:55

Animating Skins

Postby Nigey » 11 Mar 2015, 16:51

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!
User avatar
Bax
Site Admin
Posts: 4409
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Animating Skins

Postby Bax » 12 Mar 2015, 11:50

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.
Paolo Bax
The SmartFoxServer Team
Nigey
Posts: 35
Joined: 17 Dec 2014, 21:55

Re: Animating Skins

Postby Nigey » 12 Mar 2015, 16:00

Working perfectly, cheers

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 3 guests