RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-13 Thread Mike Keesey
I prefer underscores for fields, too, but I'd still use the
belowmentioned constructor argument syntax if I wanted to set a property
corresponding to a field so as to take advantage of any format-checking
in the property setter:

class PolarCoordinate extends Object {
public function PolarCoordinate(radius:Number, theta:Number) {
super();
this.radius = radius;
this.theta = theta;
}
public function get radius():Number {
return _radius;
}
public function set radius(value:Number):Void {
if (isNaN(value) || !isFinite(value)) {
// Default to 0.
_radius = 0;
} else {
_radius = value;
}
}
public function get theta():Number {
return _theta;
}
public function set theta(value:Number):Void {
if (isNaN(value) || !isFinite(value)) {
// Default to 0.
_theta = 0;
} else {
// Normalize: 0 ≤ θ  2π
while (value  0) {
value += Math.PI * 2;
}
while (value = Math.PI * 2) {
value -= Math.PI * 2;
}
_theta = value;
}
}
private var _radius:Number;
private var _theta:Number;
}
�D
Mike Keesey

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:flashcoders-
 [EMAIL PROTECTED] On Behalf Of JOR
 Sent: Thursday, October 12, 2006 7:27 PM
 To: Flashcoders mailing list
 Subject: Re: [Flashcoders] Moving to AS2, array always undefined
 
 No, it isn't wrong which was entire the point of my earlier response.
I
 gave essentially the same example as you.  In fact, you've included it
 quoted at the bottom of your response which I left intact.
 
 However, just because it is correct doesn't mean I prefer it over
other
 conventions.  I prefer to use underscores with my field names.
 
 -- james
 
 
 
 Ash Warren wrote:
  In practice, you're right and I try not to name any parameters the
same
 as
  a field name to avoid this confusion.  Don't tell anyone, but
 sometimes I
  don't even use this. :)
 
  So this is wrong?
 
  function MyClass (myParam1:Number, myParam2:String)
  {
  this.myParam1 = myParam1;
  this.myParam2 = myParam2;
  }
 
  For me this method seems much easier to read and it even refers to
 naming
  parameters this way in the adobe best-practices article.
 
  Why try and come up with 2 names for the same thing, when one will
 suffice
  just fine?
 
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf Of JOR
  Sent: Tuesday, October 10, 2006 5:52 PM
  To: Flashcoders mailing list
  Subject: Re: [Flashcoders] Moving to AS2, array always undefined
 
  A bad practice most likely, but not technically wrong.  I do see it
in
  text books from time to time.  I was just mentioning it as a case
where
  this *would* be needed as opposed to speaking in absolutes.
 
  In practice, you're right and I try not to name any parameters the
same
  as a field name to avoid this confusion.  Don't tell anyone, but
  sometimes I don't even use this. :)
 
  James O'Reilly  -  Consultant
  Adobe Certified Flash Expert
  http://www.jamesor.com
  Design . Code . Train
 
 
 
  Steven Sacks | BLITZ wrote:
 
 Correct me if I'm wrong, but it looks like your rationale is
entirely
 based on an argument name being identical to a class variable name.
I
 might be looking at this too simply, but shouldn't you just use a
 different argument name if it clashes with a class variable name?
 
 -Steven
 
 
 
 
 -Original Message-
 From: [EMAIL PROTECTED]
[mailto:flashcoders-
 [EMAIL PROTECTED] On Behalf Of JOR
 Sent: Tuesday, October 10, 2006 1:19 PM
 To: Flashcoders mailing list
 Subject: Re: [Flashcoders] Moving to AS2, array always undefined
 
 Actually, the need is dependent on the implementation.
 
 It was my understanding that AS first looks to the local scope for
the
 existence of a variable then works up to find it.  By using this
you
 were explicitly telling flash that the var isn't local to the
function
 but rather belongs to the object cutting out a step for the VM.
 
 Therefore, something like the following becomes possible and the
use
 
 of
 
 
 this becomes necessary:
 
 class MyConstructor {
   private var target:MovieClip;
   public function MyConstructor (target:MovieClip) {
 this.target = target;
   }
 }
 
 Because you can not do this:
 
 class MyConstructor {
   private var target:MovieClip;
   public function MyConstructor (target:MovieClip) {
 target = target; // ?
   }
 }
 
 However, depending on your naming conventions you might not have
to
 use this if you did something like the following

RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Ash Warren
In practice, you're right and I try not to name any parameters the same as
a field name to avoid this confusion.  Don't tell anyone, but sometimes I
don't even use this. :)

So this is wrong?

function MyClass (myParam1:Number, myParam2:String)
{
this.myParam1 = myParam1;
this.myParam2 = myParam2;
}

For me this method seems much easier to read and it even refers to naming
parameters this way in the adobe best-practices article.

Why try and come up with 2 names for the same thing, when one will suffice
just fine?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of JOR
Sent: Tuesday, October 10, 2006 5:52 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Moving to AS2, array always undefined

A bad practice most likely, but not technically wrong.  I do see it in 
text books from time to time.  I was just mentioning it as a case where 
this *would* be needed as opposed to speaking in absolutes.

In practice, you're right and I try not to name any parameters the same 
as a field name to avoid this confusion.  Don't tell anyone, but 
sometimes I don't even use this. :)

James O'Reilly  -  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design . Code . Train



Steven Sacks | BLITZ wrote:
 Correct me if I'm wrong, but it looks like your rationale is entirely
 based on an argument name being identical to a class variable name.  I
 might be looking at this too simply, but shouldn't you just use a
 different argument name if it clashes with a class variable name?
 
 -Steven
 
 
 
-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of JOR
Sent: Tuesday, October 10, 2006 1:19 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Moving to AS2, array always undefined

Actually, the need is dependent on the implementation.

It was my understanding that AS first looks to the local scope for the
existence of a variable then works up to find it.  By using this you
were explicitly telling flash that the var isn't local to the function
but rather belongs to the object cutting out a step for the VM.

Therefore, something like the following becomes possible and the use
 
 of
 
this becomes necessary:

class MyConstructor {
   private var target:MovieClip;
   public function MyConstructor (target:MovieClip) {
 this.target = target;
   }
}

Because you can not do this:

class MyConstructor {
   private var target:MovieClip;
   public function MyConstructor (target:MovieClip) {
 target = target; // ?
   }
}

However, depending on your naming conventions you might not have to
use this if you did something like the following:

class MyConstructor {
   private var _target:MovieClip;
   public function MyConstructor (target:MovieClip) {
 _target = target;
   }
}

Even still, I think the VM might check for the existence of a var
 
 named
 
_target local to the constructor function before locating the object's
field named _target.

It's been a while since I've done anything in AS1 so I may be way off
here but I thought I remembered this being necessary because at
 
 weird
 
times the VM would think you were trying to instantiate a local var if
you didn't use this.  Particularly in on (something) event
 
 handlers.
 
Maybe I'm thinking of _global, or perhaps both.  This, I'm not sure
about... if you'll excuse the pun. :)
 
___
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

___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Steven Sacks | BLITZ
 A bad practice most likely, but not technically wrong.  I do see it in
 text books from time to time.  

When I was in 10th grade, I had a French teacher who marked a question
on a test wrong because the test came from the teacher's version of the
text book and her book had a different (wrong) answer.  The question was
to provide the French word for the opposite of now.  The correct
answer is then but the text book said it was after.  Everyone knows
the opposite of before is after.  The vocabulary word we learned
that week was the French word for after however that was not the
correct answer to the question on the test.  If they wanted me to answer
after then the test should have used before.  I argued with the
teacher for about 20 minutes to no avail and then I took it to the
principal of the school and in the end I lost in the face of absolute
insanity and the question remained marked as incorrect.

That is an extreme example since using this is not wrong like saying
the opposite of now is after, but I guess the point I'm trying to
make is that you have complete control over the code you write and the
implication that because a book uses a poor example we should code that
way is just as insane as marking a correct answer on a test wrong
because a book says it is.  :)

___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Dave Watts
 The question was to provide the French word for the opposite 
 of now. The correct answer is then but the text book said 
 it was after.

This is way OT, but then is not the opposite of now in English or French
any more than after is. The expression now and then is common in
English, but that doesn't make them antonyms. And, if my high-school French
hasn't failed me, maintenant et ensuite is a somewhat common expression.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
 
Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore and Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!
___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Glen Pike
There's more than one way to skin a cat is another common expression, 
but it does not mean we all go around doing it :)


Dave Watts wrote:
The question was to provide the French word for the opposite 
of now. The correct answer is then but the text book said 
it was after.



This is way OT, but then is not the opposite of now in English or French
any more than after is. The expression now and then is common in
English, but that doesn't make them antonyms. And, if my high-school French
hasn't failed me, maintenant et ensuite is a somewhat common expression.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
 
Fig Leaf Software provides the highest caliber vendor-authorized

instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore and Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!
___
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


  

___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Paul Venton
Says who?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Glen Pike
Sent: 12 October 2006 21:20
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Moving to AS2, array always undefined

There's more than one way to skin a cat is another common expression, 
but it does not mean we all go around doing it :)



___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Steven Sacks | BLITZ
 then is not the opposite of now

Now means at the present time.  Then means at any other time other
than now.  They are opposite.

The phrase now and then has no bearing on the denotation of the words.
Then is the antonym of now.  If you disagree, what do you think is
the opposite of now?  It certainly isn't after because after is
the opposite of before.

Feel free to engage me further in this logomachy off-list.  :)

___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Troy Rollins


On Oct 12, 2006, at 5:38 PM, Steven Sacks | BLITZ wrote:


If you disagree, what do you think is
the opposite of now?  It certainly isn't after because after is
the opposite of before.


!now

--
Troy
RPSystems, Ltd.
http://www.rpsystems.net


___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Merrill, Jason
!now

LOL Troy - excellent way to get us back on topic.  

Jason Merrill
Bank of America 
Learning  Organization Effectiveness - Technology Solutions 
 
 
 
 
___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Weaver Hickerson

Opposite denotes more of a polar difference (hot/cold, black/white, up/down)

then can refer to any point, for example 1 second ago, along a time
continuum.  

By your argument, 11:01 AM is the opposite of 11:02 AM...





 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Steven
 Sacks | BLITZ
 Sent: Thursday, October 12, 2006 5:38 PM
 To: Flashcoders mailing list
 Subject: RE: [Flashcoders] Moving to AS2, array always undefined
 
 
  then is not the opposite of now
 
 Now means at the present time.  Then means at any other time other
 than now.  They are opposite.
 
 The phrase now and then has no bearing on the denotation of 
 the words.
 Then is the antonym of now.  If you disagree, what do you think is
 the opposite of now?  It certainly isn't after because after is
 the opposite of before.
 
 Feel free to engage me further in this logomachy off-list.  :)
 
 ___
 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
 
___
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

Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Muzak
http://osflash.org/flashcoders/etiquette
quote
Keep it coding
There are plenty of other places to talk about general Flash topics, and even 
more places to talk about non-Flash topics.
/quote


- Original Message - 
From: Weaver Hickerson [EMAIL PROTECTED]
To: 'Flashcoders mailing list' flashcoders@chattyfig.figleaf.com
Sent: Friday, October 13, 2006 12:10 AM
Subject: RE: [Flashcoders] Moving to AS2, array always undefined



 Opposite denotes more of a polar difference (hot/cold, black/white, up/down)

 then can refer to any point, for example 1 second ago, along a time
 continuum.

 By your argument, 11:01 AM is the opposite of 11:02 AM...
com 


___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Steven Sacks | BLITZ
So you're saying Now refers to this SINGLE point in time, and Then
refers to ANY point other than Now.  Definite vs indefinite.  

If you put it in code the opposite of now is !now or not now, and when
is not now?  Then.

The plaintiff rests.

___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Corey Knafelz

This aftenoon I subscribed to this list once again. And now I remember why I
unsubscribed from the list so many months ago. Goodbye again.


On 10/12/06, Steven Sacks | BLITZ [EMAIL PROTECTED] wrote:



The plaintiff rests.



___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Steven Sacks | BLITZ
 This aftenoon I subscribed to this list once again. And now I remember
why
 I unsubscribed from the list so many months ago. Goodbye again.

You'll be missed.  Again.  ;)

___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Corey Knafelz

get fucked jerk.

On 10/12/06, Steven Sacks | BLITZ [EMAIL PROTECTED] wrote:


 This aftenoon I subscribed to this list once again. And now I remember
why
 I unsubscribed from the list so many months ago. Goodbye again.

You'll be missed.  Again.  ;)

___
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


___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Jim Kremens

Steven,

There is a better place for your really strong opinions... your blog!

Please limit contributions to this list to code.  There's a reason for
the list etiquette guidelines:

quote
Keep it coding
There are plenty of other places to talk about general Flash topics,
and even more places to talk about non-Flash topics.
/quote

People venting and sounding off on all sorts of topics only serves to
pollute the list and make it a far less valuable resource.

Plus, you've sparked more than a few angry responses.  It's getting old...

Jim Kremens
___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Dave Watts
OK. This is my fault, I provided an off-topic response to Steven's on-topic
post, and he replied with an invitation to discuss it off-list. So, I
apologize. Please end this here. Thanks!

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information! 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf 
 Of Jim Kremens
 Sent: Thursday, October 12, 2006 7:00 PM
 To: Flashcoders mailing list
 Subject: Re: [Flashcoders] Moving to AS2, array always undefined
 
 Steven,
 
 There is a better place for your really strong opinions... your blog!
 
 Please limit contributions to this list to code.  There's a 
 reason for the list etiquette guidelines:
 
 quote
 Keep it coding
 There are plenty of other places to talk about general Flash 
 topics, and even more places to talk about non-Flash topics.
 /quote
 
 People venting and sounding off on all sorts of topics only 
 serves to pollute the list and make it a far less valuable resource.
 
 Plus, you've sparked more than a few angry responses.  It's 
 getting old...
 
 Jim Kremens
 ___
 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
 
___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Steven Sacks | BLITZ
 get fucked jerk.

What happened to that whole unsubscribing thing you mentioned?  How did
you even receive this message if you unsubscribed?  And if it indeed was
not an honest statement and instead a sarcastic comment, why are you
surprised by a sarcastic comment in return?  I did get f**ked.  By your
mom.  She jerked me too.  I've fulfilled your request, it's the least I
could do.  And you should heed Jason's request and not swear on the
mailing list.  His bosses are watching.

___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Reuben Stanton

Can you boys take it off list please?

On 13/10/2006, at 10:54 AM, Steven Sacks | BLITZ wrote:


get fucked jerk.


What happened to that whole unsubscribing thing you mentioned?  How  
did
you even receive this message if you unsubscribed?  And if it  
indeed was

not an honest statement and instead a sarcastic comment, why are you
surprised by a sarcastic comment in return?  I did get f**ked.  By  
your
mom.  She jerked me too.  I've fulfilled your request, it's the  
least I

could do.  And you should heed Jason's request and not swear on the
mailing list.  His bosses are watching.

___
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



___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread Steven Sacks | BLITZ
fin.

___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-12 Thread JOR
No, it isn't wrong which was entire the point of my earlier response. I 
gave essentially the same example as you.  In fact, you've included it 
quoted at the bottom of your response which I left intact.


However, just because it is correct doesn't mean I prefer it over other 
conventions.  I prefer to use underscores with my field names.


-- james



Ash Warren wrote:

In practice, you're right and I try not to name any parameters the same as
a field name to avoid this confusion.  Don't tell anyone, but sometimes I
don't even use this. :)

So this is wrong?

function MyClass (myParam1:Number, myParam2:String)
{
this.myParam1 = myParam1;
this.myParam2 = myParam2;
}

For me this method seems much easier to read and it even refers to naming
parameters this way in the adobe best-practices article.

Why try and come up with 2 names for the same thing, when one will suffice
just fine?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of JOR
Sent: Tuesday, October 10, 2006 5:52 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Moving to AS2, array always undefined

A bad practice most likely, but not technically wrong.  I do see it in 
text books from time to time.  I was just mentioning it as a case where 
this *would* be needed as opposed to speaking in absolutes.


In practice, you're right and I try not to name any parameters the same 
as a field name to avoid this confusion.  Don't tell anyone, but 
sometimes I don't even use this. :)


James O'Reilly  -  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design . Code . Train



Steven Sacks | BLITZ wrote:


Correct me if I'm wrong, but it looks like your rationale is entirely
based on an argument name being identical to a class variable name.  I
might be looking at this too simply, but shouldn't you just use a
different argument name if it clashes with a class variable name?

-Steven





-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of JOR
Sent: Tuesday, October 10, 2006 1:19 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Moving to AS2, array always undefined

Actually, the need is dependent on the implementation.

It was my understanding that AS first looks to the local scope for the
existence of a variable then works up to find it.  By using this you
were explicitly telling flash that the var isn't local to the function
but rather belongs to the object cutting out a step for the VM.

Therefore, something like the following becomes possible and the use


of



this becomes necessary:

class MyConstructor {
 private var target:MovieClip;
 public function MyConstructor (target:MovieClip) {
   this.target = target;
 }
}

Because you can not do this:

class MyConstructor {
 private var target:MovieClip;
 public function MyConstructor (target:MovieClip) {
   target = target; // ?
 }
}

However, depending on your naming conventions you might not have to
use this if you did something like the following:

class MyConstructor {
 private var _target:MovieClip;
 public function MyConstructor (target:MovieClip) {
   _target = target;
 }
}

Even still, I think the VM might check for the existence of a var


named



_target local to the constructor function before locating the object's
field named _target.

It's been a while since I've done anything in AS1 so I may be way off
here but I thought I remembered this being necessary because at


weird



times the VM would think you were trying to instantiate a local var if
you didn't use this.  Particularly in on (something) event


handlers.



Maybe I'm thinking of _global, or perhaps both.  This, I'm not sure
about... if you'll excuse the pun. :)



___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Merrill, Jason
You have to initialize (create) the array.  Same as in AS 1.0.  

myArray = new Array();

This:

 public var items_arr:Array;

Doesn't create the array, it only typecasts the variable.


Jason Merrill
Bank of America 
Learning  Organization Effectiveness - Technology Solutions 
 
 
 
 
 
-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Jon Bennett
Sent: Tuesday, October 10, 2006 1:06 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Moving to AS2, array always undefined

Hi,

got a AS NooB Q.

I'm working on a project and have decided to finally jump ship to AS2,
but I've run into a (probably obvious) problem which has me a bit
stumped.

I've written a class, in which I have an array, but the array always
traces 'undefined' and I can't work out why.

right, so example code:

// ArrayTest.as

class ArrayTest {

  public var items_arr:Array;

  public function ArrayTest ()
  {
  }

  public function test (str:String)
  {
  this.items_arr.push (str);
  trace (this.items_arr);
  }
}

// Timeline

// import class
import ArrayTest.as;
// create instance
var Test:ArrayTest = new ArrayTest();
// add some values to the array
Test.test ('foo');
Test.test ('bar');

I'm pretty sure this is just me not grasping something bleedin'
obvious!

tia,

jon

--


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett
___
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
___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Jon Bennett

You have to initialize (create) the array.  Same as in AS 1.0.

myArray = new Array();

This:

 public var items_arr:Array;

Doesn't create the array, it only typecasts the variable.


hah, wicked - thought it'd be s basic error but didn't think it would
be _that_ basic ;)

thanks!

jon

--


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett
___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Naicu Octavian

Its teh same when  you create an Object; :)

On 10/10/06, Jon Bennett [EMAIL PROTECTED] wrote:


 You have to initialize (create) the array.  Same as in AS 1.0.

 myArray = new Array();

 This:

  public var items_arr:Array;

 Doesn't create the array, it only typecasts the variable.

hah, wicked - thought it'd be s basic error but didn't think it would
be _that_ basic ;)

thanks!

jon

--


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett
___
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





--
Thank you,
Naicu Octavian,
Project Manager for AVChat
http://www.avchat.net
---
This message is for the designated recipient only and may contain
privileged or confidential information. If you have received it in error,
please notify the sender immediately and delete the original. Any other
use of this e-mail by you is prohibited.
___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Steven Sacks | BLITZ
I prefer 

myArray = [];

and

myObject = {};

But that's just me.  :)
___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Doug Coning
Stephen, is that A2 standard way for initializing an object or is that
old A1 style? 

Thanks,

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven
Sacks | BLITZ
Sent: Tuesday, October 10, 2006 2:24 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Moving to AS2, array always undefined

I prefer 

myArray = [];

and

myObject = {};

But that's just me.  :)
___
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
 
This e-mail and any attachment(s) are intended for the specified recipient(s) 
only and are legally protected.  If you have received this communication in 
error, please reply to sender's e-mail address with notification of the error 
and then destroy this message in all electronic and physical forms.
___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Steven Sacks | BLITZ
It's neither AS2 or AS1 centric.

Substituting [] for new Array() or {} for new Object() is universal
across many languages.  Personally, I prefer the visual [] and {} to the
wordy new Array() and new Object().  It's quicker to write, and it's
easier to read.  

[] 

{}

Plenty of research has been done on the subject of icons versus words
but suffice to say we don't write 100 dollars and 0 cents, we write
$100.00.  When you write music you don't write QUARTER NOTE C.  You just
draw a quarter note symbol on the C line.  That's how I look at writing
code.
:)

___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Hans Wichman

Hi,
and one other note,

don't do:

class ArrayTest {
  public var items_arr:Array = [];
}

becoz that will be the same as :
class ArrayTest {
  public static var items_arr:Array = []; }

initialize the array in your constructor instead.

greetz
JC

ps flash bug


On 10/10/06, Jon Bennett [EMAIL PROTECTED] wrote:


 You have to initialize (create) the array.  Same as in AS 1.0.

 myArray = new Array();

 This:

  public var items_arr:Array;

 Doesn't create the array, it only typecasts the variable.

hah, wicked - thought it'd be s basic error but didn't think it would
be _that_ basic ;)

thanks!

jon

--


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett
___
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


___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Merrill, Jason
Y'all are nerds.  

Jason Merrill
Bank of America 
Learning  Organization Effectiveness - Technology Solutions 
 
 
 
 
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Steven Sacks | BLITZ
Sent: Tuesday, October 10, 2006 2:56 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Moving to AS2, array always undefined

It's neither AS2 or AS1 centric.

Substituting [] for new Array() or {} for new Object() is universal
across many languages.  Personally, I prefer the visual [] and {} to
the
wordy new Array() and new Object().  It's quicker to write, and it's
easier to read.

[]

{}

Plenty of research has been done on the subject of icons versus words
but suffice to say we don't write 100 dollars and 0 cents, we write
$100.00.  When you write music you don't write QUARTER NOTE C.  You
just
draw a quarter note symbol on the C line.  That's how I look at
writing
code.
:)

___
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
___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Ian Thomas

On 10/10/06, Steven Sacks | BLITZ [EMAIL PROTECTED] wrote:

Plenty of research has been done on the subject of icons versus words
but suffice to say we don't write 100 dollars and 0 cents, we write
$100.00.  When you write music you don't write QUARTER NOTE C.  You just
draw a quarter note symbol on the C line.  That's how I look at writing
code.


While I don't subscribe to that particular philosphy, I use
var arr:Array=[];
too, simply because in MX/MX04 I've occasionally had completely
inexplicable errors using =new Array() that went away when I replaced
it with =[]. I assume it was a compiler error. It's probably been fixed by now,
but old habits die hard...

Ian
___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread JOR
In AS2 typecasting helps uncover bugs at compile time, so its a good 
idea to use them.  Typecasting also enables class insight through popup 
menus when you type a period after your variable name.


In AS3 typecasting is a much cooler as it directly affects the amount of 
memory allocated for the variable.  You can read about typecasting in 
AS2 and AS3 in my blog entry:

http://www.jamesor.com/2006/08/23/strong-typing-comes-of-age-in-avm2/

In your class there are a few ways to handle the initialization.  You 
can do it at the field level like this:


class ArrayTest {
  public var aryItems:Array = new Array();
  public function test (str:String):Void
  {
this.aryItems.push (str);
trace (this.aryItems);
  }
}

Or you can do it in the class' constructor:

class ArrayTest {
  public var aryItems:Array;
  public function ArrayTest ()
  {
this.aryItems = new Array();
  }
  public function test (str:String):Void
  {
this.aryItems.push (str);
trace (this.aryItems);
  }
}

Or you can create an init() function that
can be used by the constructor as well as being called again after 
object creation.


class ArrayTest {
  public var aryItems:Array;
  public function ArrayTest ()
  {
init();
  }
  public function init ():Void
  {
this.aryItems = new Array();
// other object initializing stuff
  }
  public function test (str:String):Void
  {
this.aryItems.push (str);
trace (this.aryItems);
  }
}

There are more ways to do it than that but those are pretty common and 
should get you started.


You might want to get used to using typecasting because if you ever move 
on to AS3 you will have to use it as its a requirement.



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Jon Bennett wrote:

Hi,

got a AS NooB Q.

I'm working on a project and have decided to finally jump ship to AS2,
but I've run into a (probably obvious) problem which has me a bit
stumped.

I've written a class, in which I have an array, but the array always
traces 'undefined' and I can't work out why.

right, so example code:

// ArrayTest.as

class ArrayTest {

public var items_arr:Array;

public function ArrayTest ()

{
}

public function test (str:String)

{
this.items_arr.push (str);
trace (this.items_arr);
}
}

// Timeline

// import class
import ArrayTest.as;
// create instance
var Test:ArrayTest = new ArrayTest();
// add some values to the array
Test.test ('foo');
Test.test ('bar');

I'm pretty sure this is just me not grasping something bleedin' obvious!

tia,

jon


___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Ian Thomas

On 10/10/06, Hans Wichman [EMAIL PROTECTED] wrote:

Hi,
and one other note,

don't do:

class ArrayTest {
   public var items_arr:Array = [];
}

becoz that will be the same as :
class ArrayTest {
   public static var items_arr:Array = []; }

initialize the array in your constructor instead.

greetz
JC

ps flash bug


Not so much a bug as a feature of the fact that the language is prototype based.
See here for more info:
http://www.osflash.org/flashcoders/as2#why_does_my_initializer_get_shared_across_all_instances_like_it_s_static

(watch for line wraps)

Ian
___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Victor Gaudioso
This makes sense to me because Steven is talking about the instantiation of 
the array and not the delcaration.  So, in your properties you would still 
need this:


private var myArray:Array

Right?

V
- Original Message - 
From: Steven Sacks | BLITZ [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Tuesday, October 10, 2006 11:56 AM
Subject: RE: [Flashcoders] Moving to AS2, array always undefined


It's neither AS2 or AS1 centric.

Substituting [] for new Array() or {} for new Object() is universal
across many languages.  Personally, I prefer the visual [] and {} to the
wordy new Array() and new Object().  It's quicker to write, and it's
easier to read.

[]

{}

Plenty of research has been done on the subject of icons versus words
but suffice to say we don't write 100 dollars and 0 cents, we write
$100.00.  When you write music you don't write QUARTER NOTE C.  You just
draw a quarter note symbol on the C line.  That's how I look at writing
code.
:)

___
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

___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Victor Gaudioso

Haha, ain't it the truth
- Original Message - 
From: Merrill, Jason [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Tuesday, October 10, 2006 12:03 PM
Subject: RE: [Flashcoders] Moving to AS2, array always undefined


Y'all are nerds.  


Jason Merrill
Bank of America 
Learning  Organization Effectiveness - Technology Solutions 








-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Steven Sacks | BLITZ
Sent: Tuesday, October 10, 2006 2:56 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Moving to AS2, array always undefined

It's neither AS2 or AS1 centric.

Substituting [] for new Array() or {} for new Object() is universal
across many languages.  Personally, I prefer the visual [] and {} to

the

wordy new Array() and new Object().  It's quicker to write, and it's
easier to read.

[]

{}

Plenty of research has been done on the subject of icons versus words
but suffice to say we don't write 100 dollars and 0 cents, we write
$100.00.  When you write music you don't write QUARTER NOTE C.  You

just

draw a quarter note symbol on the C line.  That's how I look at

writing

code.
:)

___
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

___
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


___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Steven Sacks | BLITZ
Sorry for the confusion.  I wasn't referring to the typecasting just the
instantiation.  You should still use

myArray:Array = [];

and

myObject:Object = {};


BLITZ | Steven Sacks - 310-551-0200 x209

___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Merrill, Jason
myArray:Array = [];

and

myObject:Object = {};

Or, 

myArray:Array = new Array()

and

myObject:Object = new Object();

Nothing wrong with that.  :) 

If anything, I like using the new operator as it is consistent with
creating other objects. new Sound() new MovieClip() (AS 3.0), new
SuperCoolClass().  


Jason Merrill
Bank of America 
Learning  Organization Effectiveness - Technology Solutions 
 
 
 
 
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Steven Sacks | BLITZ
Sent: Tuesday, October 10, 2006 3:24 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Moving to AS2, array always undefined

Sorry for the confusion.  I wasn't referring to the typecasting just
the
instantiation.  You should still use

myArray:Array = [];

and

myObject:Object = {};


BLITZ | Steven Sacks - 310-551-0200 x209

___
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
___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Jon Bennett

Or you can do it in the class' constructor:

class ArrayTest {
   public var aryItems:Array;
   public function ArrayTest ()
   {
 this.aryItems = new Array();
   }
   public function test (str:String):Void
   {
 this.aryItems.push (str);
 trace (this.aryItems);
   }
}


I like this method best I think, so this is the one I'll be using.

thanks for all the thoughts!

jon

--


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett
___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Steven Sacks | BLITZ
There's no need to use this when referring to class variables from
within the class itself.

class ArrayTest {
public var myArray:Array;

public function ArrayTest() {
myArray = [];
}
public function test(str:String):Void {
myArray.push(str);
trace(myArray);
}
}

BLITZ | Steven Sacks - 310-551-0200 x209

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:flashcoders-
 [EMAIL PROTECTED] On Behalf Of Jon Bennett
 Sent: Tuesday, October 10, 2006 12:44 PM
 To: Flashcoders mailing list
 Subject: Re: [Flashcoders] Moving to AS2, array always undefined
 
  Or you can do it in the class' constructor:
 
  class ArrayTest {
 public var aryItems:Array;
 public function ArrayTest ()
 {
   this.aryItems = new Array();
 }
 public function test (str:String):Void
 {
   this.aryItems.push (str);
   trace (this.aryItems);
 }
  }

___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Prakaz

Hi,

talking about square brackets, dunno how relevant this would be in the post
but you could also use it to make function calls:

function foo(param1:String,param2:String):void{
   trace(param1+   +param2);
}

this function can be called by using:
foo(hello,world!);
or
*this[foo](hello,world);
*
P


On 10/11/06, Steven Sacks | BLITZ [EMAIL PROTECTED] wrote:


Sorry for the confusion.  I wasn't referring to the typecasting just the
instantiation.  You should still use

myArray:Array = [];

and

myObject:Object = {};


BLITZ | Steven Sacks - 310-551-0200 x209

___
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


___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Steven Sacks | BLITZ
 talking about square brackets, dunno how relevant this would be

Bracket access is a separate discussion, yes.  :)

___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread JOR

Actually, the need is dependent on the implementation.

It was my understanding that AS first looks to the local scope for the 
existence of a variable then works up to find it.  By using this you 
were explicitly telling flash that the var isn't local to the function 
but rather belongs to the object cutting out a step for the VM.


Therefore, something like the following becomes possible and the use of 
this becomes necessary:


class MyConstructor {
  private var target:MovieClip;
  public function MyConstructor (target:MovieClip) {
this.target = target;
  }
}

Because you can not do this:

class MyConstructor {
  private var target:MovieClip;
  public function MyConstructor (target:MovieClip) {
target = target; // ?
  }
}

However, depending on your naming conventions you might not have to 
use this if you did something like the following:


class MyConstructor {
  private var _target:MovieClip;
  public function MyConstructor (target:MovieClip) {
_target = target;
  }
}

Even still, I think the VM might check for the existence of a var named 
_target local to the constructor function before locating the object's 
field named _target.


It's been a while since I've done anything in AS1 so I may be way off 
here but I thought I remembered this being necessary because at weird 
times the VM would think you were trying to instantiate a local var if 
you didn't use this.  Particularly in on (something) event handlers. 
Maybe I'm thinking of _global, or perhaps both.  This, I'm not sure 
about... if you'll excuse the pun. :)



James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Steven Sacks | BLITZ wrote:

There's no need to use this when referring to class variables from
within the class itself.

class ArrayTest {
public var myArray:Array;

public function ArrayTest() {
myArray = [];
}
public function test(str:String):Void {
myArray.push(str);
trace(myArray);
}
}

BLITZ | Steven Sacks - 310-551-0200 x209



-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Jon Bennett
Sent: Tuesday, October 10, 2006 12:44 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Moving to AS2, array always undefined



Or you can do it in the class' constructor:

class ArrayTest {
  public var aryItems:Array;
  public function ArrayTest ()
  {
this.aryItems = new Array();
  }
  public function test (str:String):Void
  {
this.aryItems.push (str);
trace (this.aryItems);
  }
}




___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Steven Sacks | BLITZ
Correct me if I'm wrong, but it looks like your rationale is entirely
based on an argument name being identical to a class variable name.  I
might be looking at this too simply, but shouldn't you just use a
different argument name if it clashes with a class variable name?

-Steven


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:flashcoders-
 [EMAIL PROTECTED] On Behalf Of JOR
 Sent: Tuesday, October 10, 2006 1:19 PM
 To: Flashcoders mailing list
 Subject: Re: [Flashcoders] Moving to AS2, array always undefined
 
 Actually, the need is dependent on the implementation.
 
 It was my understanding that AS first looks to the local scope for the
 existence of a variable then works up to find it.  By using this you
 were explicitly telling flash that the var isn't local to the function
 but rather belongs to the object cutting out a step for the VM.
 
 Therefore, something like the following becomes possible and the use
of
 this becomes necessary:
 
 class MyConstructor {
private var target:MovieClip;
public function MyConstructor (target:MovieClip) {
  this.target = target;
}
 }
 
 Because you can not do this:
 
 class MyConstructor {
private var target:MovieClip;
public function MyConstructor (target:MovieClip) {
  target = target; // ?
}
 }
 
 However, depending on your naming conventions you might not have to
 use this if you did something like the following:
 
 class MyConstructor {
private var _target:MovieClip;
public function MyConstructor (target:MovieClip) {
  _target = target;
}
 }
 
 Even still, I think the VM might check for the existence of a var
named
 _target local to the constructor function before locating the object's
 field named _target.
 
 It's been a while since I've done anything in AS1 so I may be way off
 here but I thought I remembered this being necessary because at
weird
 times the VM would think you were trying to instantiate a local var if
 you didn't use this.  Particularly in on (something) event
handlers.
 Maybe I'm thinking of _global, or perhaps both.  This, I'm not sure
 about... if you'll excuse the pun. :)

___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread ryanm

Plenty of research has been done on the subject of icons versus words
but suffice to say we don't write 100 dollars and 0 cents, we write
$100.00.  When you write music you don't write QUARTER NOTE C.  You just
draw a quarter note symbol on the C line.  That's how I look at writing
code.
:)

   Assembly/machine languages are iconic, programming languages are 
supposed to be verbose. ;-)


ryanm 


___
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


RE: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Steven Sacks | BLITZ
 Assembly/machine languages are iconic, programming languages are
 supposed to be verbose. ;-)

Your mom is verbose!  ;)
___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread JOR
A bad practice most likely, but not technically wrong.  I do see it in 
text books from time to time.  I was just mentioning it as a case where 
this *would* be needed as opposed to speaking in absolutes.


In practice, you're right and I try not to name any parameters the same 
as a field name to avoid this confusion.  Don't tell anyone, but 
sometimes I don't even use this. :)


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Steven Sacks | BLITZ wrote:

Correct me if I'm wrong, but it looks like your rationale is entirely
based on an argument name being identical to a class variable name.  I
might be looking at this too simply, but shouldn't you just use a
different argument name if it clashes with a class variable name?

-Steven




-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of JOR
Sent: Tuesday, October 10, 2006 1:19 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Moving to AS2, array always undefined

Actually, the need is dependent on the implementation.

It was my understanding that AS first looks to the local scope for the
existence of a variable then works up to find it.  By using this you
were explicitly telling flash that the var isn't local to the function
but rather belongs to the object cutting out a step for the VM.

Therefore, something like the following becomes possible and the use


of


this becomes necessary:

class MyConstructor {
  private var target:MovieClip;
  public function MyConstructor (target:MovieClip) {
this.target = target;
  }
}

Because you can not do this:

class MyConstructor {
  private var target:MovieClip;
  public function MyConstructor (target:MovieClip) {
target = target; // ?
  }
}

However, depending on your naming conventions you might not have to
use this if you did something like the following:

class MyConstructor {
  private var _target:MovieClip;
  public function MyConstructor (target:MovieClip) {
_target = target;
  }
}

Even still, I think the VM might check for the existence of a var


named


_target local to the constructor function before locating the object's
field named _target.

It's been a while since I've done anything in AS1 so I may be way off
here but I thought I remembered this being necessary because at


weird


times the VM would think you were trying to instantiate a local var if
you didn't use this.  Particularly in on (something) event


handlers.


Maybe I'm thinking of _global, or perhaps both.  This, I'm not sure
about... if you'll excuse the pun. :)



___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Jon Bennett

A bad practice most likely, but not technically wrong.  I do see it in
text books from time to time.  I was just mentioning it as a case where
this *would* be needed as opposed to speaking in absolutes.

In practice, you're right and I try not to name any parameters the same
as a field name to avoid this confusion.  Don't tell anyone, but
sometimes I don't even use this. :)


ok - some interesting points here. could someone clarify for me
please, whether I should be using this in my classes or not! It's
really just a habit I've been in to do so.

Also, what's the current naming convention? It used to be to add a
_suffix to each item, to trigger the code hints (and help
readability), but from the posts above, it looks like people are
prefering to use a suffic preceeding, is it just personal preference
or is there some best practice here.

Thanks!

jon
ps: I'm enjoying getting my feet wet with AS2 atm :)

--


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett
___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread Muzak

http://www.adobe.com/devnet/flash/articles/as_bestpractices.html

check the archives or search flashcoders through google
http://muzakdeezign.com/flashcoders/
http://muzakdeezign.com/flashcoders/?q=best%20practices
http://muzakdeezign.com/flashcoders/?q=AS2%20best%20practices
http://muzakdeezign.com/flashcoders/?q=OOP%20best%20practices

Muzak

- Original Message - 
From: Jon Bennett [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Wednesday, October 11, 2006 1:53 AM
Subject: Re: [Flashcoders] Moving to AS2, array always undefined


 A bad practice most likely, but not technically wrong.  I do see it in
 text books from time to time.  I was just mentioning it as a case where
 this *would* be needed as opposed to speaking in absolutes.

 In practice, you're right and I try not to name any parameters the same
 as a field name to avoid this confusion.  Don't tell anyone, but
 sometimes I don't even use this. :)

 ok - some interesting points here. could someone clarify for me
 please, whether I should be using this in my classes or not! It's
 really just a habit I've been in to do so.

 Also, what's the current naming convention? It used to be to add a
 _suffix to each item, to trigger the code hints (and help
 readability), but from the posts above, it looks like people are
 prefering to use a suffic preceeding, is it just personal preference
 or is there some best practice here.

 Thanks!

 jon
 ps: I'm enjoying getting my feet wet with AS2 atm :)

 -- 


 jon bennett


___
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


Re: [Flashcoders] Moving to AS2, array always undefined

2006-10-10 Thread JOR

Muzak wrote:

http://www.adobe.com/devnet/flash/articles/as_bestpractices.html



Cool find.  Thanks for the link
James
___
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