Beno wrote:

> I have this code:
> package
> {
>  <snip>
>      public var myThumb:CloseThumb;
>
>   <snip>
>      public function theThumb():void
>       {
>               myThumb = new CloseThumb();
>               myThumb.x = 365;
>               myThumb.y = 355;
>               myThumb.addEventListener(Event.ENTER_FRAME, checkFrame);
>       }
> public function checkFrame(e:Event):void {
> if (e.target.currentFrame == 1) {
> e.target.removeEventListener(Event.ENTER_FRAME, checkFrame);
> }
> It works fine. The problem is that if I change currentFrame from == 1 to any
> other value, it breaks. The reason apparently is because the mc in the fla
> is only 1 frame long. Now, I need to be able to call it from various frames.
> I've been told to extend it to, for example, 2 frames, but that does
> nothing. My main timeline also has but one frame calling the actionscript.
> Apparently it's useless to have a listener checkframe on an mc that has 1
> frame.

It sounds like you pretty much answered the question yourself. If your
movie is only 1 frame long, naturally it won't execute if you test for
frame 2. I'm not sure why you would want to check for frame 2, anyway.

 For that matter, I'm not sure why you're checking for frame 1 if you
know that's where you'll always be. I'm afraid I also don't understand
what you're doing with the checkFrame handler, anyway. All it does is
remove itself, at least from the code you posted, so I don't
understand what the handler does.

A lot of AS3 movies are single-frame movies because AS3 lends itself
to OOP programming so well. I do a lot of enterFrame handling in my
movies, so it's not intrinsically bad.

Cordially,

Kerry Thompson

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to