Yes u can i did it before... Just Import the classes below the functions u
wrote on the timeline...

On 3/17/07, Roman Hippler <[EMAIL PROTECTED]> wrote:

If your class extends MovieClip and you have attached it to a MovieClip
in the library, you should be able to call the functions on the timeline
just as if they where methods of your class.

You just have to make sure that
- your class is dynamic
- you invoke the functions with the "this" keyword
- the MovieClip is completely loaded and initialized before calling any
function

// on the timeline:
function doSomething(pString:String):Void
{
   trace(pString);
}

// your class:
dynamic class ExtendedMovieClip extends MovieClip
{
   public function ExtendedMovieClip()
   {
      super();
   }

   private function onLoad():Void
   {
      this.doSomething("hi there");
   }
}

Keep in mind that, because the class is dynamic, you won't get any
compiler errors when invoking a function that doesn't exists. You also
risk to overwrite class methods with timeline functions (the timeline is
initialized after the class is instantiated) ... but hey ... we're not
talking about whether it's *right* to do things that way, are we? ;-)
Rewriting your code would definitely be the better way to do it.

Roman

Danny Kodicek schrieb:
>
>
>> if you are using classes, why do you have code in the
>> movieclip timeline ???
>>
>
> Because sometimes it's easier that way. (And because this is a legacy
> project that I'm trying not to *completely* rewrite...). Specifically,
I've
> already got a load of movieclips with similar functionality, which I was
> hoping I might be able to attach a class to while still keeping the
> different functions (rather than having to make a new class for every
> symbol).
>
> Like I said, I'm not suggesting it's *right* to do things this way, just
> asking if it's *possible*...
>
> Danny
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com




--
Omar Fouad - Digital Emotions...

Love is always patient and kind. It is never jealous. Love is never boastful
nor conceited It is never rude or selfish. It does not take offense and is
not resentful. Love takes no pleasure in other people's sins...but delights
in the truth. It is always ready to excuse, to trust, to hope... and to
endure... whatever comes.
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to