Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 93032

Re: referencing between custom classes

$
0
0

Hi,

 

Thank you all for your replays.

 

Got some new terminology– Singelton, Setters and Getters.

Have not come across before:)

 

I do know the inheritance and have used it. And my little experience with it told me as well – it’s something you shouldn’t go crazy or fanatic with. Overusing it makes things complicated.

 

Amy, what you descibed is how I normally do use the classes – attach them to the Library symbols.

 

In my question I meant one concrete Movie Clip which is one sub-part of the application.

 

The Movie Clip is just an animated picture. That Movie Clip (girlSwim) is attached to the base class GirlSwim.

And that class is at the moment handling the animation for that girl swimming. It would be good to have that code on a sub-level symbol, like the Girl, but as a mask is swimming along as well, it got too complicated for me to code, cross reference the nested symbols. So the code ended up on top level symbol.

In that Movie Clip are other animating symbols as well and they are all handled with other custom classes.

 

When the girlSwim Movie Clip is activated, it’s on screen, dragonflies start to fly in and fishes start to swim in as well. They are not on the original picture, so not on stage.

And adding them is managed with timers and it continues as long as the Movie Clip is on screen.

 

At the moment I have all the stuff related to dragonflies and fishes on the first keyframe.

And it all functions nicely.

But as I’m practicing now using class files and keeping my timeline action script free (except some stop and goto staff to handle the timeline animations), I want to get that part of the code into class file as well.

I could but it all into the class GirlSwim and it would function.

But as the animation code for the girl is long enough, I though it would be good to have the code for dragonflies and fishes separate.

But it needs to be initiated by the GirlSwim class.

 

So … in my little-simple world I thought the following could work .. but it didn’t:)

1180: Call to a possibly undefined method timerStartDragonflies.

 

 

package

{

public class GirlSwim extends MovieClip

{

      public function GirlSwim()

      {

           timerStartDragonflies ();

      }

}

}

 

 

package

{

public class Dragonflies extends MovieClip

{

public function Dragonflies ()

                {

                                //empty

                }

 

                internal function timerStartDragonflies():void

                {

                               //code for starting timer

                }

 

                etc.

}

}

 

Is something like that possible or should I put it all into the GirlSwim class?


Viewing all articles
Browse latest Browse all 93032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>