you can create a method in a class, that extends MovieClip, and call it from
the timeline, whem the mc's already exists. But the problem is that you will
have to remember that there is code (and logic) in the .fla file, not only
in the .AS files. That is the problem: updates can be difficult if you
forget (or don't document) this kind of thing. If somebody reads the code of
your class, it should not be necessary that she/he looks for code in the
timeline of the movie clip associated with your class (or in any other
timeline).

[]'s
andrei


On 6/11/07, Muzak <[EMAIL PROTECTED]> wrote:


----- Original Message -----
From: "Johan Nyberg" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, June 11, 2007 11:27 AM
Subject: [Flashcoders] Scripting for objects that appear later on
thetimeline


> Hi, how do you script for things that appear later on the timeline? I
program in AS2 and I've started to place all my scripts in a
> Main.as file. But there is a limitation, I can't program for mc:s that
have not yet appeared on the _root timeline. I still have
> to revert to placing scripts in a layer on the _root timeline on the
appropriate frame. Anyone have a solution?
>
> I've found my own technique when I use the Main.as file: I place an
empty movieclip on _root level that has Main.as linked to it.
> Then in the constructor I use with(_root){} which I find convenient.
Thoughts on this? Is there a better solution?
>

Yes there is.. Don't use _root. Use your Main class/MovieClip as a
replacer for _root.
So rather than placing/attaching everything to the root timeline, place it
in/attach it to the Main MovieClip.

Here's what it looks like in an ARP type application:
http://muzakdeezign.com/arp/arp_application.jpg

Look into MVC/MVP and other Design Patterns for how to structure a Flash
application and forget about the timeline and jumping from
keyframe to keyframe.

regards,
Muzak


_______________________________________________
[email protected]
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

_______________________________________________
[email protected]
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