Cedric Muller wrote:
in the end, using 'this' or leaving it does make a difference, doesn't it ?
I cannot decompile to test my sayings, but 'this' adds more bytecode to
the file ??
I'm pretty sure it's just compiled into the same bytecode either way.
There are a number of ways to test that,
Unless someone has coded a very odd compiler*, for most compilers of most
languages including 'this' won't make any difference to the compiled
bytecode.
Ian
*But then, it _is_ Macromedia. You never know. ;-)
On 10/31/05, Cedric Muller [EMAIL PROTECTED] wrote:
in the end, using 'this' or
so, people not using 'this' assume something not really achievable in
terms of 'technology' ?
;)
I cannot decompile to test my sayings, but 'this' adds more bytecode
to the file ??
No, if you leave it off, it is added at compile time. Like I said,
you can't call methods that aren't
correction/confirmation:
'this' keyword is added everywhere it is needed during compile time.
Cedric Muller wrote:
in the end, using 'this' or leaving it does make a difference,
doesn't it ?
I cannot decompile to test my sayings, but 'this' adds more bytecode
to the file ??
I'm pretty sure
Ian Thomas wrote:
Unless someone has coded a very odd compiler*, ...
*But then, it _is_ Macromedia. You never know. ;-)
Yes, it _is_ Macromedia :-) For a very odd compiler, look no further
than Lingo.
- Robert
___
Flashcoders mailing list
ryanm wrote:
I cannot decompile to test my sayings, but 'this' adds more bytecode
to the file ??
No, if you leave it off, it is added at compile time. Like I said,
you can't call methods that aren't members of an object; all functions
must be members of some object. AS1/2 allows you to
this is logical: you assign handleXML function to 'xmlDoc.onLoad'
handler which means that 'handleXML' belongs to xmlDoc from now on ...
In such cases, I do the following:
class ParseXML{
private var xmlDoc:XML;
private function handleXML(){
trace(owner);
}
function
Why? haha, sorry, but to me it looks like you just added var owner =
this just to avoid putting trace(this) for no reason other than avoiding
to use this.
What's the specific reason you did that? I'm guessing you're smarter
than me :)
- Andreas
Cedric Muller wrote:
this is logical: you
Andreas Rønning wrote:
2. What the hell is going on with this here
class ParseXML{
private var xmlDoc:XML;
private function handleXML(){
trace(this);
}
function ParseXML(url:String){
xmlDoc = new XML();
xmlDoc.ignoreWhite = true;
xmlDoc.onLoad =
I am not smarter than you, oh no! Delegate's smarter than us, and AS3
is King!! (problem solved in the future)
I am simply declaring a variable in the class which refers to the class
itself. This frees me from the scope trap (using this with 'onLoad') :
public function handleXML () {
Morten Barklund Shockwaved wrote:
Andreas Rønning wrote:
class ParseXML{private var xmlDoc:XML;private function
handleXML(){trace(this);}function
ParseXML(url:String){xmlDoc = new XML();
xmlDoc.ignoreWhite = true;xmlDoc.onLoad = handleXML;
On 10/31/05, Morten Barklund Shockwaved [EMAIL PROTECTED]
wrote:
It is amazing how we can turn back to this first-grade example of
understanding scoping in ActionScript almost daily.
True - but this highlights a flaw in the language rather than a flaw in the
questioner... if the same
Andreas Rønning wrote:
[snip]
*Yawn* here we go again, another new guy trying to understand this
OBVIOUS concept that we've been through so many times already. I
can't believe he's bothering us with this again!
[snip]
Sorry, I was in a bad mood due to other circumstances, had just
Ok. Since I was the 'ass' that started this junk by asking why this
was needed, maybe I can be the 'ass' that will end it.
This thread started with Andreas asking about addChild. Fair enough.
I asked about a specific example that used this on a method which was
a member of the same class
]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Friday, October 28, 2005 5:37 PM
Subject: Re: [Flashcoders] Newbie AS3 question
Well, to me it's the other way around.
Code that doesn't use proper references looks messy to me.
Whe I'm lazy or in a hurry, I do skip them, but I usually
@chattyfig.figleaf.com
Sent: Saturday, October 29, 2005 10:19 AM
Subject: Re: [Flashcoders] Newbie AS3 question
It does a little. Why can't can't you just extend the base
CurrencyFormatter class and do the same thing for the formatValue function?
Rather than return the correct one for getInstance
: Saturday, October 29, 2005 10:19 AM
Subject: Re: [Flashcoders] Newbie AS3 question
It does a little. Why can't can't you just extend the base
CurrencyFormatter class and do the same thing for the formatValue function?
Rather than return the correct one for getInstance(), just utilize
-
From: Spike [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Saturday, October 29, 2005 12:05 PM
Subject: Re: [Flashcoders] Newbie AS3 question
It's not necessarily any better from an implementation point of view. You
can often do the same thing
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Newbie AS3 question
That makes perfect sense and is a good reason.
So, from this 2nd conversation, I've gleaned something else to add to the
list:
- getInstance() is a unspoken standard that implies the class is a Singleton
used in other
PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Newbie AS3 question
You're welcome!
This has been an interesting thread and I've learned a bit more about
ActionScript in the process :-)
Spike
On 10/29/05, JesterXL [EMAIL PROTECTED] wrote:
That makes perfect sense and is a good
JesterXL wrote:
I didn't know what a Singleton was until AS2 was well underway.
I didn't know that it was called a Singleton until Moocks book :)
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
]
[mailto:[EMAIL PROTECTED] On Behalf Of JesterXL
Sent: October 29, 2005 12:48 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Newbie AS3 question
I didn't know what a Singleton was until AS2 was well underway.
- Original Message -
From: Frédéric v. Bochmann [EMAIL PROTECTED
- Original Message -
From: Frédéric v. Bochmann [EMAIL PROTECTED]
To: 'Flashcoders mailing list' flashcoders@chattyfig.figleaf.com
Sent: Saturday, October 29, 2005 6:32 PM
Subject: RE: [Flashcoders] Newbie AS3 question
(*Just looking back at the title of this Thread*)
Just in case
Woah, I never noticed you can private your constructor!! Lol
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: October 29, 2005 1:15 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Newbie AS3 question
Well, actually
fast,
thats why.
- Original Message -
From: Frédéric v. Bochmann [EMAIL PROTECTED]
To: 'Flashcoders mailing list' flashcoders@chattyfig.figleaf.com
Sent: Saturday, October 29, 2005 1:18 PM
Subject: RE: [Flashcoders] Newbie AS3 question
True, nobody called that a Singleton until half way
The thought of changing multiple lines of code to go from static to non
would really suck; that drives the point home for me. Thanks for taking
the
time to explain it Spike!
That's that whole maintainability thing, which, in commercial software,
is usually just as or even more important
Still weirding me out. To me part of the appeal of working with movieclips
is their inherent hierarchy, which makes a kind of basic sense that's easy
to grasp.
To a Flash developer who understands Flash and has been working with it
for a long time, that's true. To anyone coming from
Assuming the Game class is your root/stage class:
Public class Game extends MovieClip {
public function Game(){
var gameworld:MovieClip = new MovieClip(); //new GameWorld()?
this.addChild( gameworld );
var game_bg:MovieClip = new MovieClip();
Shaw, Matt wrote:
Assuming the Game class is your root/stage class:
Public class Game extends MovieClip {
public function Game(){
var gameworld:MovieClip = new MovieClip(); //new GameWorld()?
this.addChild( gameworld );
var game_bg:MovieClip = new MovieClip();
Good lord!
Why do you say that?
It's an extra 2 lines of code and it allows you to reparent any of the
children of any of the movie clipse.
I'd be more inclined to say it's awesome!
Spike
On 10/28/05, Andreas Rønning [EMAIL PROTECTED] wrote:
Shaw, Matt wrote:
Assuming the Game class is
On Oct 28, 2005, at 1:55 PM, Shaw, Matt wrote:
Assuming the Game class is your root/stage class:
Public class Game extends MovieClip {
public function Game(){
var gameworld:MovieClip = new MovieClip(); //new GameWorld()?
this.addChild( gameworld );
var
, 2005 2:54 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Newbie AS3 question
On Oct 28, 2005, at 1:55 PM, Shaw, Matt wrote:
Assuming the Game class is your root/stage class:
Public class Game extends MovieClip {
public function Game(){
var gameworld:MovieClip = new
You don't need to use the 'this' keyword.
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jon Bradley
Sent: Friday, October 28, 2005 2:54 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Newbie AS3 question
On Oct 28, 2005, at 1:55 PM, Shaw
: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Shaw, Matt
Sent: October 28, 2005 1:55 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Newbie AS3 question
Assuming the Game class is your root/stage class:
Public class Game extends MovieClip {
public function Game(){
var
I'd be more inclined to say it's awesome!
I have to agree, I'm just dissapointed that it doesn't work like that in
Flash 8.
ryanm
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
This example makes me wonder:
If I was to write this in AS2, it would probably look like:
Think of it like this: createEmptyMovieClip is functionally equivilent
to new MovieClip PLUS addChild. The benefit of seperating them is that
you can add things to and remove things from the display
Wood [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Friday, October 28, 2005 11:03 PM
Subject: Re: [Flashcoders] Newbie AS3 question
ryanm wrote:
What I don't get is why it needs this.addChild instead of just addChild.
I've been sick of the keyword
, Matt
Sent: October 28, 2005 1:55 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Newbie AS3 question
Assuming the Game class is your root/stage class:
Public class Game extends MovieClip {
public function Game(){
var gameworld:MovieClip = new MovieClip(); //new GameWorld
The keyword this makes sense to me. I use it for instance variables. I
guess at the end of the day, though, as long as you're consistent anyone
can pick up your code.
For MovieClip and addChild, is this similar to the way we use XML in AS2?
As in, you use createElement, then appendChild?
day, there is no point.
- Original Message -
From: Muzak [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Friday, October 28, 2005 5:37 PM
Subject: Re: [Flashcoders] Newbie AS3 question
Well, to me it's the other way around.
Code that doesn't
well.
If you do it every day, there is no point.
- Original Message -
From: Muzak [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Friday, October 28, 2005 5:37 PM
Subject: Re: [Flashcoders] Newbie AS3 question
Well, to me it's the other way
PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Friday, October 28, 2005 6:40 PM
Subject: Re: [Flashcoders] Newbie AS3 question
ok, so if in AS 3.0 i make an array of new MovieClip() objects, i
can choose to only keep one actually instantiated by only adding the
one i
-
From: JesterXL [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Friday, October 28, 2005 6:58 PM
Subject: Re: [Flashcoders] Newbie AS3 question
Close; the MovieClip IS instantiated, just not drawn. I think Ryan said it
best earlier when you think
?
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of JesterXL
Sent: October 28, 2005 6:58 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Newbie AS3 question
Close; the MovieClip IS instantiated, just not drawn. I think Ryan said it
best earlier when
Sent: Friday, October 28, 2005 9:25 PM
Subject: Re: [Flashcoders] Newbie AS3 question
Naw, I don't know the exact way Singleton is implemented, hence my long
battle with finding clarification. It could of been solved in 10 seconds
over a beer, but email sux.
I figured Math.abs was the Singleton
Can you elaborate? Why wouldn't the static class work in that case?
- Original Message -
From: Spike [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Friday, October 28, 2005 9:54 PM
Subject: Re: [Flashcoders] Newbie AS3 question
ok,
That's just
46 matches
Mail list logo