Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Juan Pablo Califano
No worries, Zeh. I'm glad it was of use.

Cheers
Juan Pablo Califano

2009/4/12 Zeh Fernando 

> Many thanks for the in-depth reply, Juan. I learned something today.
>
> Zeh
>
> On Sun, Apr 12, 2009 at 5:14 PM, Juan Pablo Califano <
> califa010.flashcod...@gmail.com> wrote:
>
> > The problem is that, while static initializer blocks look like their
> > counterparts in Java, they have a little but important difference. Even
> > though you use curly braces, you're not creating a new scope. In AS,
> scope
> > is either class / global or local (to a function or method).
> >
> > So, you cannot declare var i:int and access it statically, since by
> default
> > variables and methods are not static. An option is to make i static as
> you
> > did, but it looks ugly, since i is clearly a temporary variable.
> >
> > In C# you can declare a static constructor to handle such a situation
> (I'm
> > not 100% sure, but I think you can't use static initializers). This
> > constructor is automatically called when the class is loaded, or at
> least,
> > before the first instance is created.
> >
> > In Actionscript, you don't have this feature, but you can do something
> > similar, except you'd have to call your "static constructor" (or, more
> > properly, initializer method) manually.
> >
> > You could do something like this:
> >
> >
> >private static var BLACK:TextFormat = new TextFormat('Arial', 24,
> > 0x00, true);
> >private static var RED:TextFormat   = new TextFormat('Arial', 24,
> > 0xFF, true);
> >
> > //  run static initializer method
> >{
> >staticInit();
> >}
> >
> >private static function staticInit():void {
> > BLACK.letterSpacing = -4;
> >RED.letterSpacing = -4;
> > // i is now a local var and will go out of scope when this
> function
> > returns
> >for (var i:int = 0; i < 10; i++)
> >trace(i);
> >}
> >
> > In fact, there is a static constructor, but it's created ad hoc by the
> > compiler and called automatically by the runtime when the class is
> > initialized. If you decompile / disassemble your code, you'll see a
> method
> > called:
> >
> > static function YourClassName$cinit()
> >
> > This method contains all the inline static initializers. But since it's
> > generated by the compiler, you cannot declare it yourself.
> >
> > Nevertheless, making your own static initializer method and calling it
> > seems
> > a bit cleaner if you need some static initialization logic.
> >
> >
> > Cheers
> > Juan Pablo Califano
> >
> >
> > 2009/4/12 Alexander Farber 
> >
> > > Hello,
> > >
> > > I have a static initializer in my class and it works ok:
> > >
> > > private static var BLACK:TextFormat = new TextFormat('Arial', 24,
> > > 0x00, true);
> > > private static var RED:TextFormat   = new TextFormat('Arial', 24,
> > > 0xFF, true);
> > > // place "1" closer to "0" in the "10" string
> > > {
> > >BLACK.letterSpacing = -4;
> > >RED.letterSpacing = -4;
> > > }
> > >
> > > But when I try to add a for-loop there (I need to
> > > add some data to static array I have in the class),
> > > then I get errors "Access of undefined property i":
> > >
> > > {
> > >BLACK.letterSpacing = -4;
> > >RED.letterSpacing = -4;
> > >
> > >for (var i:uint = 0; i < 10; i++)
> > >trace(i);
> > > }
> > >
> > > I have to move the variable i outside the initializer:
> > >
> > > private static var i:uint;
> > > {
> > >BLACK.letterSpacing = -4;
> > >RED.letterSpacing = -4;
> > >
> > >for (i = 0; i < 10; i++)
> > >trace(i);
> > > }
> > >
> > > Isn't it strange? It looks ugly to me...
> > >
> > > Regards
> > > Alex
> > > ___
> > > Flashcoders mailing list
> > > Flashcoders@chattyfig.figleaf.com
> > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > >
> > ___
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] multiple masked mcs

2009-04-12 Thread Karl DeSaulniers

Here is a sample of what I was talking about:
//-- other code missing (not imp)
var thumbHolder = attachMovie("holderMC", "holderMC" + i, i);
thumbHolder._x = i * spacing;
thumbHolder._y = 0;
var thumbLoader = thumbHolder.attachMovie("thumbMC", "thumbMC",  
this.getNextHighestDepth());
var thumbMask = thumbHolder.attachMovie("MaskClip", "MaskClip",  
this.getNextHighestDepth());

thumbMask._x = thumbLoader._x = 0;
thumbMask._y = thumbLoader._y = 0;
thumbLoader.loaded = function():Void {
thumbLoader.setMask(thumbMask);
}
//-- other code missing (not imp)

Placed on my stage there is one of the MoviClips from my library  
"holderMC".

Inside this MC I have a few more MCs named "thumbMC" and "MaskClip".
"MaskClip" is on a mask layer for "thumbMC" inside "holderMC" (the  
layer shows blue).
All three are "Export For Actionscript" in their preferences in the  
library.
But I dont use this one that I place on stage, its alpha is set to 0  
so that when the dynamic images are loaded
they populate the screen and this one is just a place holder. or you  
can leave it off the stage, but make sure you select
"Export in First Frame" on each of the MCs in the library prefs if  
you dont include a place holder.


HTH,

Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Zeh Fernando
Many thanks for the in-depth reply, Juan. I learned something today.

Zeh

On Sun, Apr 12, 2009 at 5:14 PM, Juan Pablo Califano <
califa010.flashcod...@gmail.com> wrote:

> The problem is that, while static initializer blocks look like their
> counterparts in Java, they have a little but important difference. Even
> though you use curly braces, you're not creating a new scope. In AS, scope
> is either class / global or local (to a function or method).
>
> So, you cannot declare var i:int and access it statically, since by default
> variables and methods are not static. An option is to make i static as you
> did, but it looks ugly, since i is clearly a temporary variable.
>
> In C# you can declare a static constructor to handle such a situation (I'm
> not 100% sure, but I think you can't use static initializers). This
> constructor is automatically called when the class is loaded, or at least,
> before the first instance is created.
>
> In Actionscript, you don't have this feature, but you can do something
> similar, except you'd have to call your "static constructor" (or, more
> properly, initializer method) manually.
>
> You could do something like this:
>
>
>private static var BLACK:TextFormat = new TextFormat('Arial', 24,
> 0x00, true);
>private static var RED:TextFormat   = new TextFormat('Arial', 24,
> 0xFF, true);
>
> //  run static initializer method
>{
>staticInit();
>}
>
>private static function staticInit():void {
> BLACK.letterSpacing = -4;
>RED.letterSpacing = -4;
> // i is now a local var and will go out of scope when this function
> returns
>for (var i:int = 0; i < 10; i++)
>trace(i);
>}
>
> In fact, there is a static constructor, but it's created ad hoc by the
> compiler and called automatically by the runtime when the class is
> initialized. If you decompile / disassemble your code, you'll see a method
> called:
>
> static function YourClassName$cinit()
>
> This method contains all the inline static initializers. But since it's
> generated by the compiler, you cannot declare it yourself.
>
> Nevertheless, making your own static initializer method and calling it
> seems
> a bit cleaner if you need some static initialization logic.
>
>
> Cheers
> Juan Pablo Califano
>
>
> 2009/4/12 Alexander Farber 
>
> > Hello,
> >
> > I have a static initializer in my class and it works ok:
> >
> > private static var BLACK:TextFormat = new TextFormat('Arial', 24,
> > 0x00, true);
> > private static var RED:TextFormat   = new TextFormat('Arial', 24,
> > 0xFF, true);
> > // place "1" closer to "0" in the "10" string
> > {
> >BLACK.letterSpacing = -4;
> >RED.letterSpacing = -4;
> > }
> >
> > But when I try to add a for-loop there (I need to
> > add some data to static array I have in the class),
> > then I get errors "Access of undefined property i":
> >
> > {
> >BLACK.letterSpacing = -4;
> >RED.letterSpacing = -4;
> >
> >for (var i:uint = 0; i < 10; i++)
> >trace(i);
> > }
> >
> > I have to move the variable i outside the initializer:
> >
> > private static var i:uint;
> > {
> >BLACK.letterSpacing = -4;
> >RED.letterSpacing = -4;
> >
> >for (i = 0; i < 10; i++)
> >trace(i);
> > }
> >
> > Isn't it strange? It looks ugly to me...
> >
> > Regards
> > Alex
> > ___
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Juan Pablo Califano
The problem is that, while static initializer blocks look like their
counterparts in Java, they have a little but important difference. Even
though you use curly braces, you're not creating a new scope. In AS, scope
is either class / global or local (to a function or method).

So, you cannot declare var i:int and access it statically, since by default
variables and methods are not static. An option is to make i static as you
did, but it looks ugly, since i is clearly a temporary variable.

In C# you can declare a static constructor to handle such a situation (I'm
not 100% sure, but I think you can't use static initializers). This
constructor is automatically called when the class is loaded, or at least,
before the first instance is created.

In Actionscript, you don't have this feature, but you can do something
similar, except you'd have to call your "static constructor" (or, more
properly, initializer method) manually.

You could do something like this:


private static var BLACK:TextFormat = new TextFormat('Arial', 24,
0x00, true);
private static var RED:TextFormat   = new TextFormat('Arial', 24,
0xFF, true);

//  run static initializer method
{
staticInit();
}

private static function staticInit():void {
BLACK.letterSpacing = -4;
RED.letterSpacing = -4;
// i is now a local var and will go out of scope when this function
returns
for (var i:int = 0; i < 10; i++)
trace(i);
}

In fact, there is a static constructor, but it's created ad hoc by the
compiler and called automatically by the runtime when the class is
initialized. If you decompile / disassemble your code, you'll see a method
called:

static function YourClassName$cinit()

This method contains all the inline static initializers. But since it's
generated by the compiler, you cannot declare it yourself.

Nevertheless, making your own static initializer method and calling it seems
a bit cleaner if you need some static initialization logic.


Cheers
Juan Pablo Califano


2009/4/12 Alexander Farber 

> Hello,
>
> I have a static initializer in my class and it works ok:
>
> private static var BLACK:TextFormat = new TextFormat('Arial', 24,
> 0x00, true);
> private static var RED:TextFormat   = new TextFormat('Arial', 24,
> 0xFF, true);
> // place "1" closer to "0" in the "10" string
> {
>BLACK.letterSpacing = -4;
>RED.letterSpacing = -4;
> }
>
> But when I try to add a for-loop there (I need to
> add some data to static array I have in the class),
> then I get errors "Access of undefined property i":
>
> {
>BLACK.letterSpacing = -4;
>RED.letterSpacing = -4;
>
>for (var i:uint = 0; i < 10; i++)
>trace(i);
> }
>
> I have to move the variable i outside the initializer:
>
> private static var i:uint;
> {
>BLACK.letterSpacing = -4;
>RED.letterSpacing = -4;
>
>for (i = 0; i < 10; i++)
>trace(i);
> }
>
> Isn't it strange? It looks ugly to me...
>
> Regards
> Alex
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] multiple masked mcs

2009-04-12 Thread Karl DeSaulniers
I have a set of thumbnails that load from an XML file, so all the  
images are dynamic. I have a maskMc in my library that I load on top  
of my thumbnails at run time that when the thumbnail finishes, I mask  
it then and it works fine.


Sent from losPhone

On Apr 12, 2009, at 12:39 PM, "Cor"  wrote:


Ok, maybe I misunderstood the question.
And that is very possible, because my native language is Dutch.

I am so sorry!

-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of  
jonathan

howe
Sent: zondag 12 april 2009 18:01
To: Flash Coders List
Subject: Re: [Flashcoders] multiple masked mcs

Ok, I read the request backwards.

Any DisplayObject can have 0 or 1 mask
Any DisplayObject can be a mask for 0 to n other display objects.

-jonathan



On Sun, Apr 12, 2009 at 11:38 AM, Cor  wrote:


No, you can use the same mask on multiple objects

  var sqr:SquareMC = new SquareMC();
  var sqr2:SquareMC = new SquareMC();
  var msk:MaskerMC = new MaskerMC();
  sqr.mask = msk;
  sqr2.mask = msk;



-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of  
jonathan

howe
Sent: zondag 12 april 2009 17:32
To: Flash Coders List
Subject: Re: [Flashcoders] multiple masked mcs

Hi, Fabio,

I believe it is only possible to mask with a single clip at any one  
time
using the DisplayObject.mask property (note that this accepts only  
type

DisplayObject and therefore does not accept Arrays, etc.). There is

nothing
stopping you from making a composite sprite that contains all the  
clips

you
want to make be a mask, though... except if you have other  
dependencies on

the visual tree not changing.

public function set
mask(value:DisplayObject<
http://livedocs.adobe.com/flash/9.0/ActionScriptLan
gRefV3/flash/display/DisplayObject.html>
):void<
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/specialType
s.html#void>

-jonathan



On Sun, Apr 12, 2009 at 8:52 AM, Fabio Pinatti   
wrote:



Hello list,

straight and forward, sorry if the question is stupid: In flash

timeline,

I

can mask any elements as I wish, with just a single mask. isn't it

possible
with actionscript? I know, I can add everything to a holder  
movieclip

and

mask it, but there's nothing like setup a mask property to several
movieclips, right?

Thanks!

--
Fabio Pinatti
:: web.developer
 www.pinatti.com.br
:: 19. 9184.3745 / 3342.1130
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders





--
-jonathan howe
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.287 / Virus Database: 270.11.53/2054 - Release Date:  
04/11/09

10:51:00

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders





--
-jonathan howe
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.287 / Virus Database: 270.11.54/2055 - Release Date:  
04/12/09

13:14:00

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] multiple masked mcs

2009-04-12 Thread Cor
Ok, maybe I misunderstood the question.
And that is very possible, because my native language is Dutch.

I am so sorry!

-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of jonathan
howe
Sent: zondag 12 april 2009 18:01
To: Flash Coders List
Subject: Re: [Flashcoders] multiple masked mcs

Ok, I read the request backwards.

Any DisplayObject can have 0 or 1 mask
Any DisplayObject can be a mask for 0 to n other display objects.

-jonathan



On Sun, Apr 12, 2009 at 11:38 AM, Cor  wrote:

> No, you can use the same mask on multiple objects
>
>var sqr:SquareMC = new SquareMC();
>var sqr2:SquareMC = new SquareMC();
>var msk:MaskerMC = new MaskerMC();
>sqr.mask = msk;
>sqr2.mask = msk;
>
>
>
> -Original Message-
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of jonathan
> howe
> Sent: zondag 12 april 2009 17:32
> To: Flash Coders List
> Subject: Re: [Flashcoders] multiple masked mcs
>
> Hi, Fabio,
>
> I believe it is only possible to mask with a single clip at any one time
> using the DisplayObject.mask property (note that this accepts only type
> DisplayObject and therefore does not accept Arrays, etc.). There is
nothing
> stopping you from making a composite sprite that contains all the clips
you
> want to make be a mask, though... except if you have other dependencies on
> the visual tree not changing.
>
> public function set
> mask(value:DisplayObject<
> http://livedocs.adobe.com/flash/9.0/ActionScriptLan
> gRefV3/flash/display/DisplayObject.html>
> ):void<
> http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/specialType
> s.html#void>
>
> -jonathan
>
>
>
> On Sun, Apr 12, 2009 at 8:52 AM, Fabio Pinatti  wrote:
>
> > Hello list,
> >
> > straight and forward, sorry if the question is stupid: In flash
timeline,
> I
> > can mask any elements as I wish, with just a single mask. isn't it
> possible
> > with actionscript? I know, I can add everything to a holder movieclip
and
> > mask it, but there's nothing like setup a mask property to several
> > movieclips, right?
> >
> > Thanks!
> >
> > --
> > Fabio Pinatti
> > :: web.developer
> >  www.pinatti.com.br
> > :: 19. 9184.3745 / 3342.1130
> > ___
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
>
>
> --
> -jonathan howe
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.287 / Virus Database: 270.11.53/2054 - Release Date: 04/11/09
> 10:51:00
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
-jonathan howe
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.287 / Virus Database: 270.11.54/2055 - Release Date: 04/12/09
13:14:00

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] multiple masked mcs

2009-04-12 Thread jonathan howe
Ok, I read the request backwards.

Any DisplayObject can have 0 or 1 mask
Any DisplayObject can be a mask for 0 to n other display objects.

-jonathan



On Sun, Apr 12, 2009 at 11:38 AM, Cor  wrote:

> No, you can use the same mask on multiple objects
>
>var sqr:SquareMC = new SquareMC();
>var sqr2:SquareMC = new SquareMC();
>var msk:MaskerMC = new MaskerMC();
>sqr.mask = msk;
>sqr2.mask = msk;
>
>
>
> -Original Message-
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of jonathan
> howe
> Sent: zondag 12 april 2009 17:32
> To: Flash Coders List
> Subject: Re: [Flashcoders] multiple masked mcs
>
> Hi, Fabio,
>
> I believe it is only possible to mask with a single clip at any one time
> using the DisplayObject.mask property (note that this accepts only type
> DisplayObject and therefore does not accept Arrays, etc.). There is nothing
> stopping you from making a composite sprite that contains all the clips you
> want to make be a mask, though... except if you have other dependencies on
> the visual tree not changing.
>
> public function set
> mask(value:DisplayObject<
> http://livedocs.adobe.com/flash/9.0/ActionScriptLan
> gRefV3/flash/display/DisplayObject.html>
> ):void<
> http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/specialType
> s.html#void>
>
> -jonathan
>
>
>
> On Sun, Apr 12, 2009 at 8:52 AM, Fabio Pinatti  wrote:
>
> > Hello list,
> >
> > straight and forward, sorry if the question is stupid: In flash timeline,
> I
> > can mask any elements as I wish, with just a single mask. isn't it
> possible
> > with actionscript? I know, I can add everything to a holder movieclip and
> > mask it, but there's nothing like setup a mask property to several
> > movieclips, right?
> >
> > Thanks!
> >
> > --
> > Fabio Pinatti
> > :: web.developer
> >  www.pinatti.com.br
> > :: 19. 9184.3745 / 3342.1130
> > ___
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
>
>
> --
> -jonathan howe
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.287 / Virus Database: 270.11.53/2054 - Release Date: 04/11/09
> 10:51:00
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
-jonathan howe
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] multiple masked mcs

2009-04-12 Thread Cor
No, you can use the same mask on multiple objects

var sqr:SquareMC = new SquareMC();
var sqr2:SquareMC = new SquareMC();
var msk:MaskerMC = new MaskerMC();
sqr.mask = msk;
sqr2.mask = msk;



-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of jonathan
howe
Sent: zondag 12 april 2009 17:32
To: Flash Coders List
Subject: Re: [Flashcoders] multiple masked mcs

Hi, Fabio,

I believe it is only possible to mask with a single clip at any one time
using the DisplayObject.mask property (note that this accepts only type
DisplayObject and therefore does not accept Arrays, etc.). There is nothing
stopping you from making a composite sprite that contains all the clips you
want to make be a mask, though... except if you have other dependencies on
the visual tree not changing.

public function set
mask(value:DisplayObject
):void

-jonathan



On Sun, Apr 12, 2009 at 8:52 AM, Fabio Pinatti  wrote:

> Hello list,
>
> straight and forward, sorry if the question is stupid: In flash timeline,
I
> can mask any elements as I wish, with just a single mask. isn't it
possible
> with actionscript? I know, I can add everything to a holder movieclip and
> mask it, but there's nothing like setup a mask property to several
> movieclips, right?
>
> Thanks!
>
> --
> Fabio Pinatti
> :: web.developer
>  www.pinatti.com.br
> :: 19. 9184.3745 / 3342.1130
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
-jonathan howe
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.287 / Virus Database: 270.11.53/2054 - Release Date: 04/11/09
10:51:00

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] multiple masked mcs

2009-04-12 Thread jonathan howe
Hi, Fabio,

I believe it is only possible to mask with a single clip at any one time
using the DisplayObject.mask property (note that this accepts only type
DisplayObject and therefore does not accept Arrays, etc.). There is nothing
stopping you from making a composite sprite that contains all the clips you
want to make be a mask, though... except if you have other dependencies on
the visual tree not changing.

public function set
mask(value:DisplayObject
):void

-jonathan



On Sun, Apr 12, 2009 at 8:52 AM, Fabio Pinatti  wrote:

> Hello list,
>
> straight and forward, sorry if the question is stupid: In flash timeline, I
> can mask any elements as I wish, with just a single mask. isn't it possible
> with actionscript? I know, I can add everything to a holder movieclip and
> mask it, but there's nothing like setup a mask property to several
> movieclips, right?
>
> Thanks!
>
> --
> Fabio Pinatti
> :: web.developer
>  www.pinatti.com.br
> :: 19. 9184.3745 / 3342.1130
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
-jonathan howe
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] multiple masked mcs

2009-04-12 Thread Fabio Pinatti
Hello list,

straight and forward, sorry if the question is stupid: In flash timeline, I
can mask any elements as I wish, with just a single mask. isn't it possible
with actionscript? I know, I can add everything to a holder movieclip and
mask it, but there's nothing like setup a mask property to several
movieclips, right?

Thanks!

-- 
Fabio Pinatti
:: web.developer
 www.pinatti.com.br
:: 19. 9184.3745 / 3342.1130
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Karl DeSaulniers

or dont delare the ":int" part and just put i=0

I'm just guessing now.. sry

Karl DeSaulniers
Design Drumm
http://designdrumm.com

On Apr 12, 2009, at 4:58 AM, Alexander Farber wrote:

On Sun, Apr 12, 2009 at 11:46 AM, Karl DeSaulniers  
 wrote:

//for (var i:uint = 0; i < 10; i++)
for (var i:int = 0; i < 10; i++)


Nope this doesn't change anything and also

{
  var i:int;
  for (var i:int = 0; i < 10; i++)
trace(i);
}

won't work

Regards
Alex
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Karl DeSaulniers

Maybe try just:

{
  var i:int;
  for (i = 0; i < 10; i++)
trace(i);
}

no need to declare the "var" part twice on the same variable.


Karl DeSaulniers
Design Drumm
http://designdrumm.com

On Apr 12, 2009, at 4:58 AM, Alexander Farber wrote:

On Sun, Apr 12, 2009 at 11:46 AM, Karl DeSaulniers  
 wrote:

//for (var i:uint = 0; i < 10; i++)
for (var i:int = 0; i < 10; i++)


Nope this doesn't change anything and also

{
  var i:int;
  for (var i:int = 0; i < 10; i++)
trace(i);
}

won't work

Regards
Alex
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Alexander Farber
Oops a typo:

On Sun, Apr 12, 2009 at 11:58 AM, Alexander Farber
 wrote:
> Nope this doesn't change anything and also
>
> {
>      var i:int;
>      for (i = 0; i < 10; i++)
>            trace(i);
> }
>
> won't work

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Alexander Farber
On Sun, Apr 12, 2009 at 11:46 AM, Karl DeSaulniers  wrote:
> //for (var i:uint = 0; i < 10; i++)
> for (var i:int = 0; i < 10; i++)

Nope this doesn't change anything and also

{
  var i:int;
  for (var i:int = 0; i < 10; i++)
trace(i);
}

won't work

Regards
Alex
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Karl DeSaulniers

I am not a AS3 coder, but shouldn't this part be like this?

//for (var i:uint = 0; i < 10; i++)
for (var i:int = 0; i < 10; i++)


Karl DeSaulniers
Design Drumm
http://designdrumm.com
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] AS3: for-loop in a static initializer - "Access of undefined property i"

2009-04-12 Thread Alexander Farber
Hello,

I have a static initializer in my class and it works ok:

private static var BLACK:TextFormat = new TextFormat('Arial', 24,
0x00, true);
private static var RED:TextFormat   = new TextFormat('Arial', 24,
0xFF, true);
// place "1" closer to "0" in the "10" string
{
BLACK.letterSpacing = -4;
RED.letterSpacing = -4;
}

But when I try to add a for-loop there (I need to
add some data to static array I have in the class),
then I get errors "Access of undefined property i":

{
BLACK.letterSpacing = -4;
RED.letterSpacing = -4;

for (var i:uint = 0; i < 10; i++)
trace(i);
}

I have to move the variable i outside the initializer:

private static var i:uint;
{
BLACK.letterSpacing = -4;
RED.letterSpacing = -4;

for (i = 0; i < 10; i++)
trace(i);
}

Isn't it strange? It looks ugly to me...

Regards
Alex
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders