Yes, your correct.
I always use braces.
It looks aesthetically pleasing to me and helps me separate things.

BTW, what is the point of braces if you dont need them, except the separation of your code part.
Are they needed in some situations over others?

Karl


On Dec 8, 2009, at 5:25 PM, Greg Ligierko wrote:

Karl,

That is perfectly valid for AS2, for example:

for(var k in myArray) trace("val: " + myArray[k]);

...works both AS2 and AS3.

Even a combo...

if(someBoolean) for(var k in myArray) myClass(myArray [k]).doSomething();

Just one line and the semicolon ";" (required).

Man can save a pair of braces for later :)

Greg


Tuesday, December 08, 2009 (11:36:17 PM):

Greg,
I see your point.
I am more familiar with AS2, so oops.
I will be migrating soon. I promise.

Karl


On Dec 8, 2009, at 3:50 PM, Greg Ligierko wrote:

I don't think, because braces are not required when the there is only
one statement ended with semicolor:

//code
if(something) doSomething(); // semicolon ends the scope here...
//code

... the second brace was ending the myLeftHand() method.


I think that that the problem with this line was that mcHandInstance2
was neither defined as a class property nor as a local variable.

I think Beno does not see difference between local variables (google:
"local variables" tutorial) and class properties (google: "class
properties" tutorial).

g

Tuesday, December 08, 2009 (10:07:34 PM) Karl DeSaulniers wrote:

Well I know why this code was not working.

if (e.target.currentFrame == 40) TweenMax.to (mcHandInstance2, 2,
{x:200, startAt:{totalProgress:1}}).reverse();
 }

Because it should read.

    if (e.target.currentFrame == 40) { TweenMax.to
(mcHandInstance2, 2,
{x:200, startAt:{totalProgress:1}}).reverse();
 }

You missed the first "{"
Don know if that fixes everything or just this line.
Karl

Sent from losPhone

On Dec 8, 2009, at 1:18 PM, beno - <[email protected]> wrote:

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

Karl DeSaulniers
Design Drumm
http://designdrumm.com

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


--

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

Karl DeSaulniers
Design Drumm
http://designdrumm.com

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

Reply via email to