Hello,
has anybody else noticed, that the code like:
stop();
for (var i:Number = 0; i 10; i++) {
trace('1st loop: ' + i);
}
for (var i:Number = 0; i 10; i++) {
trace('2nd loop: ' + i);
}
won't be accepted by compiler?
Is there an explanation for that?
The other languages
Hello :)
Your code is in AS3 ?
In AS3 :
var i:int ; // only one
for ( i = 0; i 10; i++)
{
trace('1st loop: ' + i);
}
for ( i = 0; i 10; i++)
{
trace('2nd loop: ' + i);
}
The FlashPlayer 9 or 10 optimize the variables and you must implement a
variable one time in the same
- Original Message -
From: Alexander Farber alexander.far...@gmail.com
To: Flash Coders List flashcoders@chattyfig.figleaf.com
Sent: Tuesday, December 23, 2008 10:02 AM
Subject: [Flashcoders] Scope of variables declared in for loop
Hello,
has anybody else noticed, that the code like:
Hello, yes in AS3, but I think AS2 had the same irritating issue.
Sure you can put var i:int above.
But in many other languages (like C++, Java, Perl) you write something like
for (my $i = 0; $i 10; $i++) {
# XXX
}
an the scope of variable is limited to the loop only.
Regards
Alex
On
How do you define a code section then?
Regards
Alex
On Tue, Dec 23, 2008 at 11:25 AM, Paul Andrews p...@ipauland.com wrote:
Is there an explanation for that?
Flash doesn't scope the variables to the loop block, but to the code
section.
___
If you want to make the scope local, you can do it in a function or in a
class.
Function doLoop1():void{
for ( i = 0; i 10; i++) {
trace('1st loop: ' + i);
}
}
Function doLoop2():void{
for ( i = 0; i 10; i++) {
trace('2nd loop: ' + i);
}
}
If you would like the result
Oops, forgot to declare the i properly.
So again:
Function doLoop1():void{
for (var i:int = 0; i 10; i++) {
trace('1st loop: ' + i);
}
}
Function doLoop2():void{
for (var i:int = 0; i 10; i++) {
trace('2nd loop: ' + i);
}
}
If you would like the result outside of the
a method / function or a class / frame
On Tue, Dec 23, 2008 at 10:37 AM, Alexander Farber
alexander.far...@gmail.com wrote:
How do you define a code section then?
Regards
Alex
On Tue, Dec 23, 2008 at 11:25 AM, Paul Andrews p...@ipauland.com wrote:
Is there an explanation for that?
Yes, in AS 2 and AS 3 you have a local scope and global scope and that's it.
You can't create new nested scopes using braces or other means.
The variable declaration will be moved to the top of the function by the
compiler (I think this is called hoisting). So if you write:
function
Mendelsohn, Michael wrote:
Thanks, that's a great article...but this is a really weird issue. It
might be some sort of Windows bug.
I hit a break point, things are rendered on the stage. As soon as I
click stepIn in the debug console, the swf window crashes (not
responding).
- MM
Hello,
I have 2 classes: PlayingCard and PlayingTable.
The PlayingCard listens on MOUSE_UP, DOWN
and MOVE to call startDrag() and stopDrag().
I do not want to introduce custom events,
so I try to subscribe the PlayingTable to
MOUSE_MOVE and MOUSE_UP events
of each PlayingCard, so that the table
apologies if this is a tad vague, but i'm looking for a styling solution in
AS3. We're looking for something that is more along the lines of a style
manager to apply CSS formatting to be used in an MVC framework. if anyone
knows of such tools please advise. thanks.
Hi,
Sorry to be slightly off-topic, but I am forced to extreme measures. I have
been waiting since late October for my copy of CS4 Design Premium to ship.
We have been told its 'in processing' and all number of things. I've even
been told its been shipped by one representative, even though that
you might find that using MOUSE_MOVE is a little heavy on the processor as
it can fire multiple times, even within the same frame
it's probably better to use Event.ENTER_FRAME and check for the mouseX and
mouseY and while you're at it, you might as well use the same listener to
move the card
what would you want to style with it?
On Tue, Dec 23, 2008 at 3:59 PM, Jah flash@gmail.com wrote:
apologies if this is a tad vague, but i'm looking for a styling solution in
AS3. We're looking for something that is more along the lines of a style
manager to apply CSS formatting to be
Why not just include the detection logic inside the handlers you already
have?
On Tue, Dec 23, 2008 at 9:52 AM, Alexander Farber
alexander.far...@gmail.com wrote:
Hello,
I have 2 classes: PlayingCard and PlayingTable.
The PlayingCard listens on MOUSE_UP, DOWN
and MOVE to call startDrag()
text in multiple views.
On Tue, Dec 23, 2008 at 12:01 PM, allandt bik-elliott (thefieldcomic.com)
alla...@gmail.com wrote:
what would you want to style with it?
On Tue, Dec 23, 2008 at 3:59 PM, Jah flash@gmail.com wrote:
apologies if this is a tad vague, but i'm looking for a styling
1. Can Flex libraries (mx.*) be used in Flash CS3/4? Is this as simple
as adding source files and/or SWCs to an FLA project's classpath? And,
where are all these libraries (Windows XP or Vista)?
2. If yes, any important caveats?
3. Am I correct that all the Flash libraries (that is, all those
Caveat: I believe there has been some progress recently on the use of
Flex components created as .swcs for use within Flash CS4. You'll
probably need to look on Adobe Labs for more info on that.
Other than that, to the best of my knowledge the answers are:
1. Can Flex libraries (mx.*) be used
Thanks Ian! Helps clarify a lot!
-Jason
2008/12/23 Ian Thomas i...@eirias.net:
Caveat: I believe there has been some progress recently on the use of
Flex components created as .swcs for use within Flash CS4. You'll
probably need to look on Adobe Labs for more info on that.
Other than that,
Jason,
There is actually a way to use Flex classes in Flash CS3 -- I figured it out
a couple weeks ago when building a jabber client in AS3 using the XIFF API
(I wanted to use Flash, not Flex).
It's quite simple actually... I just put up a blog post about it.
Taka,
That's really interesting - excellent to know!
I _suspect_ (having had previous bad experiences) that doing things
within the _complete_ Flex framework will be difficult/will cause
errors. Flex has a lot of managers/singletons which seem to be very
greedy, and assume a lot i.e. assume
are you SURE you can't use embed metadata in Flash CS4? ;)
Eric
On 12/23/2008, Ian Thomas i...@eirias.net wrote:
Taka,
That's really interesting - excellent to know!
I _suspect_ (having had previous bad experiences) that doing things
within the _complete_ Flex framework will be
Maybe the courier lost the package? Maybe ask for a tracking number ;) ?
Hi,
Sorry to be slightly off-topic, but I am forced to extreme measures. I have
been waiting since late October for my copy of CS4 Design Premium to ship.
We have been told its 'in processing' and all number of things.
Thanks for your response Ashim,I will try to place the movieclip buttons into a
new unique MovieClip, and then link that mc to a new custom RadioGroup class.
We'll see where that leads me and I'll report back with my findings (or lack
of).Any other ideas out there?thanks again
On Dec 23, 2008, at 5:10 PM, Jason Boyd wrote:
1. Can Flex libraries (mx.*) be used in Flash CS3/4? Is this as simple
as adding source files and/or SWCs to an FLA project's classpath? And,
where are all these libraries (Windows XP or Vista)?
Yes.
26 matches
Mail list logo