The reason why it isn't tracing is because you are not telling the function
what mc to check if its current frame is at 10. I believe that is what the "e"
was for.
mcToCheck.addEventListener(Event.ENTER_FRAME, myLeftHand);
public function myLeftHand(e:Event):void
{
if (e.target.currentFrame == 10) { trace("yes") };
var mcHandInstance2:mcHand = new mcHand();
addChild(mcHandInstance2);
mcHandInstance2.x = 800;
mcHandInstance2.y = 200;
// if (e.target.currentFrame == 40) TweenMax.to(mcHandInstance2, 2,
{x:200, startAt:{totalProgress:1}}).reverse();
}
Now assuming no other errors, you should get a trace "yes" when the mcToCheck's
current frame hits 10.
Nathan Mynarcik
Interactive Web Developer
[email protected]
254.749.2525
www.mynarcik.com
-----Original Message-----
From: beno - <[email protected]>
Date: Tue, 8 Dec 2009 15:46:07
To: Flash Coders List<[email protected]>
Subject: Re: [Flashcoders] Back On Course, Still Problems
On Tue, Dec 8, 2009 at 3:34 PM, Gregory Boudreaux <[email protected]>wrote:
> Without knowing what else you have going on... remove all references to
> e in your current code to see if you get an error.
>
Well, that works, because it's a copy of what I have for mcRightHand except
for the trace:
public function myLeftHand():void
{
if (currentFrame == 10) { trace("yes") };
var mcHandInstance2:mcHand = new mcHand();
addChild(mcHandInstance2);
mcHandInstance2.x = 800;
mcHandInstance2.y = 200;
// if (e.target.currentFrame == 40) TweenMax.to(mcHandInstance2, 2,
{x:200, startAt:{totalProgress:1}}).reverse();
}
The problems are that the trace doesn't trace, the mc plays at frame 1 when
I want it to play at another frame, and then eventually I want to use the
TweenMax stuff to reverse the movie. What do?
TIA,
beno
>
> public function myLeftHand():void
> {
> var mcHandInstance2A:mcHand = new mcHand();
> addChild(mcHandInstance2A);
> mcHandInstance2A.x = 800;
> mcHandInstance2A.y = 200;
> }
>
>
> Just a suggestion. You should probably start writing empty functions,
> compile, and check for errors... Then add ONE line at a time and
> compile after every change. You might find your errors more easily that
> way.
>
> gregb
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of beno -
> Sent: Tuesday, December 08, 2009 1:18 PM
> To: Flash Coders List
> Subject: Re: [Flashcoders] Back On Course, Still Problems
>
> On Tue, Dec 8, 2009 at 3:02 PM, Gregory Boudreaux
> <[email protected]>wrote:
>
> > What is setting "e" in your code?
> >
>
> I have no idea. This is what was suggested to me on this list once upon
> a
> time. I presume that's the problem. The idea was to make the mc run when
> the
> code entered a certain frame, as you can see by the commented-out line
> and
> the trace:
>
> public function myLeftHand(e:Event=null):void
> {
> if (e.target.currentFrame == 10) { trace("yes") };
> var mcHandInstance2A:mcHand = new mcHand();
> addChild(mcHandInstance2A);
> mcHandInstance2A.x = 800;
> mcHandInstance2A.y = 200;
> // if (e.target.currentFrame == 40) TweenMax.to(mcHandInstance2, 2,
> {x:200, startAt:{totalProgress:1}}).reverse();
> }
>
> What should it be? How do I tie it in to the rest of the code?
> TIA,
> beno
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders