Re: [Flashcoders] BitmapData.paletteMap ()

2008-02-27 Thread Elia Morling
Thanks. I guess nobody is using the paletteMethod? It's strange that there 
exists such a function with no functions for retrieving the original palette 
for manipulation?


I asked earlier on the list if BitmapData is converted to 16 bit.
One guy thought I was an idiot and another said no.
Seemed the concensus was no.
I'm not so sure, because there is no depth property on the bitmapdata, and 
there are no limitations to operations that would otherwise be limited to 
256 colors or less.


Elia


- Original Message - 
From: "Juan Pablo Califano" <[EMAIL PROTECTED]>

To: "Flash Coders List" 
Sent: Wednesday, February 27, 2008 11:34 PM
Subject: Re: [Flashcoders] BitmapData.paletteMap ()


Perhaps you could read just the palette info from the image file instead 
of

looping through the bitmapdata to gather that data. That could be more or
less challenging depending on the file format of the image.

Cheers
Juan Pablo Califano


2008/2/27, EECOLOR <[EMAIL PROTECTED]>:


So if I understand you correctly, your question actually is: "how do I
find
out which colors are used in my bitmap data?".

I am sorry to disappoint you, but I do not have an answer for you. The
only
solution I could come up with is looping through the pixels (see the code
at
the end of the email). This loop however is too slow. On my fast machine
it
took about 2.4 seconds for an image of 2000 x 2000. If time is not an
issue
you could split the loop over multiple frames so you can show a progress
bar.

Maybe someone has a better idea for you...


Greetz Erik


var byteArray:ByteArray = bmd.getPixels(new Rectangle(0, 0, bmd.width,
bmd.height));
var red:Array = new Array();
var green:Array = new Array();
var blue:Array = new Array();
var color:uint;
var redColor:uint;
var greenColor:uint;
var blueColor:uint;
byteArray.position = 0;
while (byteArray.bytesAvailable)
{
color = byteArray.readUnsignedInt();
redColor = (color >> 16) & 0xFF;
greenColor = (color >> 8) & 0xFF;
blueColor = (color) & 0xFF;
if (!red[redColor])
{
red[redColor] = redColor;
};
if (!green[greenColor])
{
green[greenColor] = greenColor;
};
if (!blue[blueColor])
{
blue[blueColor] = blueColor;
};
};








On 2/27/08, Elia Morling <[EMAIL PROTECTED]> wrote:
>
> As indicated in earlier post I need to swap the palettes of a
bitmapdata.
>
> "public function paletteMap(sourceBitmapData:BitmapData,
> sourceRect:Rectangle, destPoint:Point, redArray:Array = null,
> greenArray:Array = null, blueArray:Array = null, alphaArray:Array =
> null):void
> Remaps the color channel values in an image that has up to four arrays
of
> color palette data, one for each channel."
>
> That is excellent, but how do I extract the current color channel 
> values

> as
> arrays so that I can maniuplate them?
>
> Elia
>
___
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] Re: Help Needed. UILoader coordinate track problem on MOUSE_UP

2008-02-27 Thread anuj sharma
Never Mind problem has been fixed. I have to pass the correct container.
Thanks for ur patience & Help
Anuj

On Wed, Feb 27, 2008 at 11:14 AM, anuj sharma <[EMAIL PROTECTED]> wrote:

> Hi again
> I have fixed this problem. Basically I was moving the UIloader but when i
> tried to move the container which contains the UIloader then it is moving
> wherever i want to. Actually I have the main stage which contains the
> container of type Sprite and that container contains UILoader which contains
> external SWF. Little tricky :-).
> Thus there was problem in moving the whole content. But Now I fixed one
> problem and came up with another . While dragging and dropping sometimes my
> program gives me the following error
> "
> ArgumentError: Error #2025: The supplied DisplayObject must be a child of
> the caller.
> at flash.display::DisplayObjectContainer/getChildIndex()
> at MethodInfo-1092()"
> I am tracking the number of children using getChildIndex. Anyone has any
> idea how would i fix this error.
> Any help will be highly appreciated.
> Thanks
> Anuj
>
>
> On Tue, Feb 26, 2008 at 3:15 PM, anuj sharma <[EMAIL PROTECTED]> wrote:
>
> > Hi All
> > I am dragging the UI loader component containing external SWfs in them.
> > On Mouse Release I use stop drag, and on stop drag- I am using
> > myUIloader.move(mouseX,mouseY). However the output is little bouncy, the
> > stage is taking the topleft corner of UIloader as main point and on stop
> > drag it is moving the top left corner of the UIloader to the point where I
> > left my mouse which gives the bouncy effect.(In short it is not dropping
> > UIloader where I am leaving my mouse but dropping the top left corner of
> > UIloader where I left the mouse.)
> >
> > I came up with the weird temporary solution where I use 
> > myUIloader.move(mouseX-200,mouseY-200)
> > which is not genuine way of solving this problem.
> > Can you please help me out for figuring this thing out? All I need is to
> > drop my UILoader wherever I left my mouse.
> > Guys,I highly appreciate your help in this matter .
> > Thanks
> > Anuj
> >
> >
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] BitmapData.paletteMap ()

2008-02-27 Thread Juan Pablo Califano
Perhaps you could read just the palette info from the image file instead of
looping through the bitmapdata to gather that data. That could be more or
less challenging depending on the file format of the image.

Cheers
Juan Pablo Califano


2008/2/27, EECOLOR <[EMAIL PROTECTED]>:
>
> So if I understand you correctly, your question actually is: "how do I
> find
> out which colors are used in my bitmap data?".
>
> I am sorry to disappoint you, but I do not have an answer for you. The
> only
> solution I could come up with is looping through the pixels (see the code
> at
> the end of the email). This loop however is too slow. On my fast machine
> it
> took about 2.4 seconds for an image of 2000 x 2000. If time is not an
> issue
> you could split the loop over multiple frames so you can show a progress
> bar.
>
> Maybe someone has a better idea for you...
>
>
> Greetz Erik
>
>
> var byteArray:ByteArray = bmd.getPixels(new Rectangle(0, 0, bmd.width,
> bmd.height));
> var red:Array = new Array();
> var green:Array = new Array();
> var blue:Array = new Array();
> var color:uint;
> var redColor:uint;
> var greenColor:uint;
> var blueColor:uint;
> byteArray.position = 0;
> while (byteArray.bytesAvailable)
> {
> color = byteArray.readUnsignedInt();
> redColor = (color >> 16) & 0xFF;
> greenColor = (color >> 8) & 0xFF;
> blueColor = (color) & 0xFF;
> if (!red[redColor])
> {
> red[redColor] = redColor;
> };
> if (!green[greenColor])
> {
> green[greenColor] = greenColor;
> };
> if (!blue[blueColor])
> {
> blue[blueColor] = blueColor;
> };
> };
>
>
>
>
>
>
>
>
> On 2/27/08, Elia Morling <[EMAIL PROTECTED]> wrote:
> >
> > As indicated in earlier post I need to swap the palettes of a
> bitmapdata.
> >
> > "public function paletteMap(sourceBitmapData:BitmapData,
> > sourceRect:Rectangle, destPoint:Point, redArray:Array = null,
> > greenArray:Array = null, blueArray:Array = null, alphaArray:Array =
> > null):void
> > Remaps the color channel values in an image that has up to four arrays
> of
> > color palette data, one for each channel."
> >
> > That is excellent, but how do I extract the current color channel values
> > as
> > arrays so that I can maniuplate them?
> >
> > Elia
> >
> ___
> 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] BitmapData.paletteMap ()

2008-02-27 Thread Elia Morling
Thanks Erik for looking into this. I don't understand how anyone can use the 
paletteMap method without knowing what order the colors in the palette are 
in? Are the colors always in the order as your loop? In photoshop a palette 
can be arranged in any way.


Elia

- Original Message - 
From: "EECOLOR" <[EMAIL PROTECTED]>

To: "Flash Coders List" 
Sent: Wednesday, February 27, 2008 10:47 PM
Subject: Re: [Flashcoders] BitmapData.paletteMap ()


So if I understand you correctly, your question actually is: "how do I 
find

out which colors are used in my bitmap data?".

I am sorry to disappoint you, but I do not have an answer for you. The 
only
solution I could come up with is looping through the pixels (see the code 
at
the end of the email). This loop however is too slow. On my fast machine 
it
took about 2.4 seconds for an image of 2000 x 2000. If time is not an 
issue

you could split the loop over multiple frames so you can show a progress
bar.

Maybe someone has a better idea for you...


Greetz Erik


var byteArray:ByteArray = bmd.getPixels(new Rectangle(0, 0, bmd.width,
bmd.height));
var red:Array = new Array();
var green:Array = new Array();
var blue:Array = new Array();
var color:uint;
var redColor:uint;
var greenColor:uint;
var blueColor:uint;
byteArray.position = 0;
while (byteArray.bytesAvailable)
{
color = byteArray.readUnsignedInt();
redColor = (color >> 16) & 0xFF;
greenColor = (color >> 8) & 0xFF;
blueColor = (color) & 0xFF;
if (!red[redColor])
{
red[redColor] = redColor;
};
if (!green[greenColor])
{
green[greenColor] = greenColor;
};
if (!blue[blueColor])
{
blue[blueColor] = blueColor;
};
};








On 2/27/08, Elia Morling <[EMAIL PROTECTED]> wrote:


As indicated in earlier post I need to swap the palettes of a bitmapdata.

"public function paletteMap(sourceBitmapData:BitmapData,
sourceRect:Rectangle, destPoint:Point, redArray:Array = null,
greenArray:Array = null, blueArray:Array = null, alphaArray:Array =
null):void
Remaps the color channel values in an image that has up to four arrays of
color palette data, one for each channel."

That is excellent, but how do I extract the current color channel values
as
arrays so that I can maniuplate them?

Elia


___
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] BitmapData.paletteMap ()

2008-02-27 Thread EECOLOR
So if I understand you correctly, your question actually is: "how do I find
out which colors are used in my bitmap data?".

I am sorry to disappoint you, but I do not have an answer for you. The only
solution I could come up with is looping through the pixels (see the code at
the end of the email). This loop however is too slow. On my fast machine it
took about 2.4 seconds for an image of 2000 x 2000. If time is not an issue
you could split the loop over multiple frames so you can show a progress
bar.

Maybe someone has a better idea for you...


Greetz Erik


var byteArray:ByteArray = bmd.getPixels(new Rectangle(0, 0, bmd.width,
bmd.height));
var red:Array = new Array();
var green:Array = new Array();
var blue:Array = new Array();
var color:uint;
var redColor:uint;
var greenColor:uint;
var blueColor:uint;
byteArray.position = 0;
while (byteArray.bytesAvailable)
{
color = byteArray.readUnsignedInt();
redColor = (color >> 16) & 0xFF;
greenColor = (color >> 8) & 0xFF;
blueColor = (color) & 0xFF;
if (!red[redColor])
{
red[redColor] = redColor;
};
if (!green[greenColor])
{
green[greenColor] = greenColor;
};
if (!blue[blueColor])
{
blue[blueColor] = blueColor;
};
};








On 2/27/08, Elia Morling <[EMAIL PROTECTED]> wrote:
>
> As indicated in earlier post I need to swap the palettes of a bitmapdata.
>
> "public function paletteMap(sourceBitmapData:BitmapData,
> sourceRect:Rectangle, destPoint:Point, redArray:Array = null,
> greenArray:Array = null, blueArray:Array = null, alphaArray:Array =
> null):void
> Remaps the color channel values in an image that has up to four arrays of
> color palette data, one for each channel."
>
> That is excellent, but how do I extract the current color channel values
> as
> arrays so that I can maniuplate them?
>
> Elia
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Any issues with Safari Mac and mouse movement detection?

2008-02-27 Thread Paul Steven
Sorry I have now realised it is a mac problem in general and not Safari mac
specific. Seems like flash runs alot more sluggish on a mac. 



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Steven
Sent: 27 February 2008 07:23
To: 'Flash Coders List'
Subject: RE: [Flashcoders] Any issues with Safari Mac and mouse movement
detection?

Yes - works absolutely perfect in Safari for Windows

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jason Van
Cleave
Sent: 27 February 2008 05:48
To: Flash Coders List
Subject: Re: [Flashcoders] Any issues with Safari Mac and mouse movement
detection?

Did you try Safari on Windows?

On Tue, Feb 26, 2008 at 12:34 PM, Paul Steven <[EMAIL PROTECTED]>
wrote:

> I have created a game that involves moving the mouse rapidly to control
> the
> speed of a character. The client has reported that it is not working on
> Safari on the Mac. I have since asked several friends to test it on Safari
> on a Mac and they also report the same problem in that it does not work.
>
> Is there a particular issues I should be aware of using Safari on the mac
> and Flash?
>
> Not sure if this is relevant, but I use AC_RunActiveContent to embed my
> flash content.
>
> I can't put up a link to the game due to it being for a client.
>
> ___
> 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


[Flashcoders] Re: Help Needed. UILoader coordinate track problem on MOUSE_UP

2008-02-27 Thread anuj sharma
Hi again
I have fixed this problem. Basically I was moving the UIloader but when i
tried to move the container which contains the UIloader then it is moving
wherever i want to. Actually I have the main stage which contains the
container of type Sprite and that container contains UILoader which contains
external SWF. Little tricky :-).
Thus there was problem in moving the whole content. But Now I fixed one
problem and came up with another . While dragging and dropping sometimes my
program gives me the following error
"
ArgumentError: Error #2025: The supplied DisplayObject must be a child of
the caller.
at flash.display::DisplayObjectContainer/getChildIndex()
at MethodInfo-1092()"
I am tracking the number of children using getChildIndex. Anyone has any
idea how would i fix this error.
Any help will be highly appreciated.
Thanks
Anuj

On Tue, Feb 26, 2008 at 3:15 PM, anuj sharma <[EMAIL PROTECTED]> wrote:

> Hi All
> I am dragging the UI loader component containing external SWfs in them. On
> Mouse Release I use stop drag, and on stop drag- I am using
> myUIloader.move(mouseX,mouseY). However the output is little bouncy, the
> stage is taking the topleft corner of UIloader as main point and on stop
> drag it is moving the top left corner of the UIloader to the point where I
> left my mouse which gives the bouncy effect.(In short it is not dropping
> UIloader where I am leaving my mouse but dropping the top left corner of
> UIloader where I left the mouse.)
>
> I came up with the weird temporary solution where I use 
> myUIloader.move(mouseX-200,mouseY-200)
> which is not genuine way of solving this problem.
> Can you please help me out for figuring this thing out? All I need is to
> drop my UILoader wherever I left my mouse.
> Guys,I highly appreciate your help in this matter .
> Thanks
> Anuj
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] quick scoping question

2008-02-27 Thread Allandt Bik-Elliott (Receptacle)

thanks for the advice

a



On 27 Feb 2008, at 18:18, Muzak wrote:


The constructor should be as empty as possible.

package com.receptacle.drawingtest{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;
public class GreetingApp extends Sprite {
  public function GreetingApp() {
   draw();
 }

 private function draw() {
  var rectAndCircle:Sprite = new Sprite();

  rectAndCircle.graphics.lineStyle(10,0x99,1);
rectAndCircle.graphics.beginFill(0xFF,1);
rectAndCircle.graphics.drawRect(125,0,150,75);
rectAndCircle.graphics.beginFill(0xFF, 0.8);
rectAndCircle.graphics.drawCircle(150,100,50);

  rectAndCircle.x = 125;
  rectAndCircle.y = 100;
  addChild(rectAndCircle);
  rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m);

  var triangle:Sprite = new Sprite();
  triangle.graphics.beginFill(0xFF5500,0.8);
  triangle.graphics.moveTo(50,0);
  triangle.graphics.lineTo(100,100);
  triangle.graphics.lineTo(0,100);
  triangle.graphics.lineTo(50,0);
  triangle.graphics.endFill();
  triangle.x = 175;
  triangle.y = 75;
  addChildAt(triangle, getChildIndex(rectAndCircle));
triangle.addEventListener(MouseEvent.MOUSE_OVER,m);

var greeting_txt:TextField = new TextField();
  greeting_txt.text = "hello world";
  greeting_txt.x = 200;
  greeting_txt.y = 300;
  addChild(greeting_txt);
 }

 private function m(evt:MouseEvent):void  {
  setChildIndex(evt.target as Sprite, numChildren-1);  }

}

}

- Original Message - From: "Allandt Bik-Elliott  
(Receptacle)" <[EMAIL PROTECTED]>

To: "Flash Coders List" 
Sent: Wednesday, February 27, 2008 6:29 PM
Subject: Re: [Flashcoders] quick scoping question



ah yeh - thanks - i'm still getting used to access-control
just out of interest - the GreetingApp is my class constructor   
method, would you still say that it should not have any functions   
within it?



___
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] quick scoping question

2008-02-27 Thread Muzak

The constructor should be as empty as possible.

package com.receptacle.drawingtest{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite {
 
 public function GreetingApp() {

   draw();
 }

 private function draw() {
  var rectAndCircle:Sprite = new Sprite();

  rectAndCircle.graphics.lineStyle(10,0x99,1); 
  rectAndCircle.graphics.beginFill(0xFF,1); 
  rectAndCircle.graphics.drawRect(125,0,150,75); 
  rectAndCircle.graphics.beginFill(0xFF, 0.8); 
  rectAndCircle.graphics.drawCircle(150,100,50);

  rectAndCircle.x = 125;
  rectAndCircle.y = 100;
  addChild(rectAndCircle);
  rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m);

  var triangle:Sprite = new Sprite();
  triangle.graphics.beginFill(0xFF5500,0.8);
  triangle.graphics.moveTo(50,0);
  triangle.graphics.lineTo(100,100);
  triangle.graphics.lineTo(0,100);
  triangle.graphics.lineTo(50,0);
  triangle.graphics.endFill();
  triangle.x = 175;
  triangle.y = 75;
  addChildAt(triangle, getChildIndex(rectAndCircle)); 
  triangle.addEventListener(MouseEvent.MOUSE_OVER,m);
  
  var greeting_txt:TextField = new TextField();

  greeting_txt.text = "hello world";
  greeting_txt.x = 200;
  greeting_txt.y = 300;
  addChild(greeting_txt);
 }

 private function m(evt:MouseEvent):void  {
  setChildIndex(evt.target as Sprite, numChildren-1); 
 }


}

}

- Original Message - 
From: "Allandt Bik-Elliott (Receptacle)" <[EMAIL PROTECTED]>

To: "Flash Coders List" 
Sent: Wednesday, February 27, 2008 6:29 PM
Subject: Re: [Flashcoders] quick scoping question



ah yeh - thanks - i'm still getting used to access-control

just out of interest - the GreetingApp is my class constructor  
method, would you still say that it should not have any functions  
within it?





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


Re: [Flashcoders] quick scoping question

2008-02-27 Thread Allandt Bik-Elliott (Receptacle)

ah yeh - thanks - i'm still getting used to access-control

just out of interest - the GreetingApp is my class constructor  
method, would you still say that it should not have any functions  
within it?


repurpose of my old code:


package com.receptacle.drawingtest
{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite
{
public function GreetingApp()
{
			//var rectAndCircle:Shape = new Shape(); shape changed to sprite  
to support mouseevent

var rectAndCircle:Sprite = new Sprite();
			//adding multiple shapes to a single Shape() instance is akin to  
creating a graphic instance
			rectAndCircle.graphics.lineStyle(10,0x99,1); // draw lines  
around all rectAndCircle objects 100% alpha (now alpha = 1)

rectAndCircle.graphics.beginFill(0xFF,1); // set 
colour on object
rectAndCircle.graphics.drawRect(125,0,150,75); // 
rectangle
			rectAndCircle.graphics.beginFill(0xFF, 0.8); // change colour  
on object 80% alpha (now alpha = 0.8)

rectAndCircle.graphics.drawCircle(150,100,50); // circle
rectAndCircle.x = 125;
rectAndCircle.y = 100;
//without this, rectAndCircle will not display
addChild(rectAndCircle);
//just for fun
rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m);

var triangle:Sprite = new Sprite();
triangle.graphics.beginFill(0xFF5500,0.8);
triangle.graphics.moveTo(50,0);
triangle.graphics.lineTo(100,100);
triangle.graphics.lineTo(0,100);
triangle.graphics.lineTo(50,0);
triangle.graphics.endFill();
triangle.x = 175;
triangle.y = 75;
			addChildAt(triangle, getChildIndex(rectAndCircle)); // puts  
triangle BELOW rectAndCircle

triangle.addEventListener(MouseEvent.MOUSE_OVER,m);

var greeting_txt:TextField = new TextField();
greeting_txt.text = "hello world";
greeting_txt.x = 200;
greeting_txt.y = 300;
addChild(greeting_txt);
}

protected function m(evt:MouseEvent):void
{
			setChildIndex(evt.target as Sprite, numChildren-1); //  
MouseEvent.target gives the target but must be a sprite

}
}
}


thanks
a



On 27 Feb 2008, at 16:38, Muzak wrote:


Casting is not hacky, it's how things are done in AS3.

Get rid of the nested function though.

 public function GreetingApp() {
 }
  protected function m(evt:MouseEvent):void{
 }

not
 public function GreetingApp() {
 function m(evt:MouseEvent):void{
 }
 }

regards,
Muzak



- Original Message - From: "Allandt Bik-Elliott  
(Receptacle)" <[EMAIL PROTECTED]>

To: "Flash Coders List" 
Sent: Wednesday, February 27, 2008 4:52 PM
Subject: Re: [Flashcoders] quick scoping question



i've amended my function to be
function m(evt:MouseEvent):void
{
setChildIndex(DisplayObject(evt.target), numChildren-1);
}
which works but forcing the object type seems a bit hacky to me  
and  doesn't really teach me anything

On 27 Feb 2008, at 14:58, Allandt Bik-Elliott (Receptacle) wrote:

hi guys

i'm playing with some as3 to get my head around it and i've come   
across a little wierdness in the drawing api that i hope you can   
shed some light on


here is my script - it's an amended version of one from  
Essential  Actionscript:




package com.receptacle.drawingtest
{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;
public class GreetingApp extends Sprite
{
public function GreetingApp()
{
//var rectAndCircle:Shape = new Shape(); shape changed to sprite   
to support mouse event

var rectAndCircle:Sprite = new Sprite();
//adding multiple shapes to a single Shape() instance is akin to   
creating a graphic instance
rectAndCircle.graphics.lineStyle(10,0x99,1); // draw lines   
around all rectAndCircle objects
rectAndCircle.graphics.beginFill(0xFF,1); // set colour on   
object

rectAndCircle.graphics.drawRect(125,0,150,75); // rectangle
rectAndCircle.graphics.beginFill(0xFF, 0.8); // change   
colour on object

rectAndCircle.graphics.drawCircle(150,100,50); // circle
rectAndCircle.x = 125;
rectAndCircle.y = 100;
//without this, rectAndCircle will not display
addChild(rectAndCircle);
//just for fun
rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m);

var triangle:Sprite = new Sprite()
triangle.graphics.beginFill(0xFF5500,0.8);
triangle.graphics.moveTo(50,0);

Re: [Flashcoders] quick scoping question

2008-02-27 Thread Allandt Bik-Elliott (Receptacle)

thankyou :)



On 27 Feb 2008, at 16:12, Cor wrote:


That was what I basicly meant

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Allandt
Bik-Elliott (Receptacle)
Verzonden: woensdag 27 februari 2008 17:03
Aan: Flash Coders List
Onderwerp: Re: [Flashcoders] quick scoping question

however

trying this did work

function m(evt:MouseEvent):void
{
setChildIndex(evt.target as Sprite,
numChildren-1);
}



On 27 Feb 2008, at 15:25, Cor wrote:


I made a minor adjustment because you have to typecast these  to a
Sprite:


package
{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite
{
public function GreetingApp()
{
//var rectAndCircle:Shape = new Shape(); shape

changed to sprite to

support mouse event
var rectAndCircle:Sprite = new Sprite();
//adding multiple shapes to a single Shape()

instance is akin to

creating a graphic instance
rectAndCircle.graphics.lineStyle(10,0x99,1); //

draw lines

around all rectAndCircle objects
rectAndCircle.graphics.beginFill(0xFF,1); // set

colour on

object
rectAndCircle.graphics.drawRect(125,0,150,75); //

rectangle

rectAndCircle.graphics.beginFill(0xFF, 0.8); //

change colour

on object
rectAndCircle.graphics.drawCircle(150,100,50); //

circle

rectAndCircle.x = 125;
rectAndCircle.y = 100;
//without this, rectAndCircle will not display
addChild(rectAndCircle);
//just for fun

rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m) as Sprite;

var triangle:Sprite = new Sprite()
triangle.graphics.beginFill(0xFF5500,0.8);
triangle.graphics.moveTo(50,0);
triangle.graphics.lineTo(100,100);
triangle.graphics.lineTo(0,100);
triangle.graphics.lineTo(50,0);
triangle.graphics.endFill();
triangle.x = 175;
triangle.y = 75;
addChildAt(triangle, getChildIndex(rectAndCircle));

// puts

triangle BELOW rectAndCircle
triangle.addEventListener(MouseEvent.MOUSE_OVER,m)
as Sprite;

function m(e:MouseEvent):void
{
trace(this);
//setChildIndex(this, numChildren-1);

//doesn't work - 'this' is

scoped to the holding object
trace(e);
}

var greeting_txt:TextField = new TextField();
greeting_txt.text = "hello world";
greeting_txt.x = 200;
greeting_txt.y = 300;
addChild(greeting_txt);
}
}
}


-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Allandt
Bik-Elliott (Receptacle)
Verzonden: woensdag 27 februari 2008 15:58
Aan: flashcoders
Onderwerp: [Flashcoders] quick scoping question

hi guys

i'm playing with some as3 to get my head around it and i've come
across a little wierdness in the drawing api that i hope you can shed
some light on

here is my script - it's an amended version of one from Essential
Actionscript:



package com.receptacle.drawingtest
{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite
{
public function GreetingApp()
{
//var rectAndCircle:Shape = new Shape(); shape

changed to sprite to

support mouse event
var rectAndCircle:Sprite = new Sprite();
//adding multiple shapes to a single Shape()

instance is akin to

creating a graphic instance
rectAndCircle.graphics.lineStyle(10,0x99,1); //

draw lines

around all rectAndCircle objects
rectAndCircle.graphics.beginFill(0xFF,1); // set

colour on

object
rectAndCircle.graphics.drawRect(125,0,150,75); //

rectangle

rectAndCircle.graphics.beginFill(0xFF, 0.8); //

change colour

on object
rectAndCircle.graphics.drawCircle(150,100,50); //

circle

rectAndCircle.x = 125;

Re: [Flashcoders] quick scoping question

2008-02-27 Thread Muzak

Casting is not hacky, it's how things are done in AS3.

Get rid of the nested function though.

 public function GreetingApp() {
 }
 
 protected function m(evt:MouseEvent):void{

 }

not 


 public function GreetingApp() {
 function m(evt:MouseEvent):void{
 }
 }

regards,
Muzak



- Original Message - 
From: "Allandt Bik-Elliott (Receptacle)" <[EMAIL PROTECTED]>

To: "Flash Coders List" 
Sent: Wednesday, February 27, 2008 4:52 PM
Subject: Re: [Flashcoders] quick scoping question



i've amended my function to be

function m(evt:MouseEvent):void
{
setChildIndex(DisplayObject(evt.target), numChildren-1);
}


which works but forcing the object type seems a bit hacky to me and  
doesn't really teach me anything



On 27 Feb 2008, at 14:58, Allandt Bik-Elliott (Receptacle) wrote:


hi guys

i'm playing with some as3 to get my head around it and i've come  
across a little wierdness in the drawing api that i hope you can  
shed some light on


here is my script - it's an amended version of one from Essential  
Actionscript:




package com.receptacle.drawingtest
{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite
{
public function GreetingApp()
{
//var rectAndCircle:Shape = new Shape(); shape changed to sprite  
to support mouse event

var rectAndCircle:Sprite = new Sprite();
//adding multiple shapes to a single Shape() instance is akin to  
creating a graphic instance
rectAndCircle.graphics.lineStyle(10,0x99,1); // draw lines  
around all rectAndCircle objects
rectAndCircle.graphics.beginFill(0xFF,1); // set colour on  
object

rectAndCircle.graphics.drawRect(125,0,150,75); // rectangle
rectAndCircle.graphics.beginFill(0xFF, 0.8); // change  
colour on object

rectAndCircle.graphics.drawCircle(150,100,50); // circle
rectAndCircle.x = 125;
rectAndCircle.y = 100;
//without this, rectAndCircle will not display
addChild(rectAndCircle);
//just for fun
rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m);

var triangle:Sprite = new Sprite()
triangle.graphics.beginFill(0xFF5500,0.8);
triangle.graphics.moveTo(50,0);
triangle.graphics.lineTo(100,100);
triangle.graphics.lineTo(0,100);
triangle.graphics.lineTo(50,0);
triangle.graphics.endFill();
triangle.x = 175;
triangle.y = 75;
addChildAt(triangle, getChildIndex(rectAndCircle)); // puts  
triangle BELOW rectAndCircle

triangle.addEventListener(MouseEvent.MOUSE_OVER,m);

function m(event:MouseEvent):void
{
setChildIndex(this, numChildren-1); //doesn't work - 'this' is  
scoped to the holding object

}

var greeting_txt:TextField = new TextField();
greeting_txt.text = "hello world";
greeting_txt.x = 200;
greeting_txt.y = 300;
addChild(greeting_txt);
}
}
}



is what i've done possible? ie can i set a single mouseListener  
method (m in my example) to be used by any of the sprites to move  
themselves to the front of the display stack or would i have to  
write an explicit statement for each one?


thanks for your time
a



___
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] quick scoping question

2008-02-27 Thread Cor
That was what I basicly meant 

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Allandt
Bik-Elliott (Receptacle)
Verzonden: woensdag 27 februari 2008 17:03
Aan: Flash Coders List
Onderwerp: Re: [Flashcoders] quick scoping question

however

trying this did work

function m(evt:MouseEvent):void
{
setChildIndex(evt.target as Sprite,
numChildren-1);
}



On 27 Feb 2008, at 15:25, Cor wrote:

> I made a minor adjustment because you have to typecast these  to a
> Sprite:
>
> 
> package
> {
>   import flash.display.*;
>   import flash.text.TextField;
>   import flash.events.MouseEvent;
>   
>   public class GreetingApp extends Sprite
>   {
>   public function GreetingApp()
>   {
>   //var rectAndCircle:Shape = new Shape(); shape
changed to sprite to 
> support mouse event
>   var rectAndCircle:Sprite = new Sprite();
>   //adding multiple shapes to a single Shape()
instance is akin to 
> creating a graphic instance
>   rectAndCircle.graphics.lineStyle(10,0x99,1); //
draw lines 
> around all rectAndCircle objects
>   rectAndCircle.graphics.beginFill(0xFF,1); // set
colour on 
> object
>   rectAndCircle.graphics.drawRect(125,0,150,75); //
rectangle
>   rectAndCircle.graphics.beginFill(0xFF, 0.8); //
change colour 
> on object
>   rectAndCircle.graphics.drawCircle(150,100,50); //
circle
>   rectAndCircle.x = 125;
>   rectAndCircle.y = 100;
>   //without this, rectAndCircle will not display
>   addChild(rectAndCircle);
>   //just for fun
>   
> rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m) as Sprite;
>
>   var triangle:Sprite = new Sprite()
>   triangle.graphics.beginFill(0xFF5500,0.8);
>   triangle.graphics.moveTo(50,0);
>   triangle.graphics.lineTo(100,100);
>   triangle.graphics.lineTo(0,100);
>   triangle.graphics.lineTo(50,0);
>   triangle.graphics.endFill();
>   triangle.x = 175;
>   triangle.y = 75;
>   addChildAt(triangle, getChildIndex(rectAndCircle));
// puts 
> triangle BELOW rectAndCircle
>   triangle.addEventListener(MouseEvent.MOUSE_OVER,m)
> as Sprite;
>   
>   function m(e:MouseEvent):void
>   {
>   trace(this);
>   //setChildIndex(this, numChildren-1);
//doesn't work - 'this' is 
> scoped to the holding object
>   trace(e);
>   }
>   
>   var greeting_txt:TextField = new TextField();
>   greeting_txt.text = "hello world";
>   greeting_txt.x = 200;
>   greeting_txt.y = 300;
>   addChild(greeting_txt);
>   }
>   }
> }
> 
>
> -Oorspronkelijk bericht-
> Van: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Namens Allandt 
> Bik-Elliott (Receptacle)
> Verzonden: woensdag 27 februari 2008 15:58
> Aan: flashcoders
> Onderwerp: [Flashcoders] quick scoping question
>
> hi guys
>
> i'm playing with some as3 to get my head around it and i've come 
> across a little wierdness in the drawing api that i hope you can shed 
> some light on
>
> here is my script - it's an amended version of one from Essential
> Actionscript:
>
> 
>
> package com.receptacle.drawingtest
> {
>   import flash.display.*;
>   import flash.text.TextField;
>   import flash.events.MouseEvent;
>   
>   public class GreetingApp extends Sprite
>   {
>   public function GreetingApp()
>   {
>   //var rectAndCircle:Shape = new Shape(); shape
changed to sprite to 
> support mouse event
>   var rectAndCircle:Sprite = new Sprite();
>   //adding multiple shapes to a single Shape()
instance is akin to 
> creating a graphic instance
>   rectAndCircle.graphics.lineStyle(10,0x99,1); //
draw lines 
> around all rectAndCircle objects
>   rectAndCircle.graphics.beginFill(0xFF,1); // set
colour on 
> object
>   rectAndCircle.graphics.drawRect(125,0,150,75); //
rectangle
>   rectAndCircle.graphics.beginFill(0xFF, 0.8); //
change colour 
> on object
>   rectAndCircle.graphics.drawCircle(150,100,50); //
circle
>   rectAndCircle.x = 125;
> 

Re: [Flashcoders] quick scoping question

2008-02-27 Thread Allandt Bik-Elliott (Receptacle)

however

trying this did work

function m(evt:MouseEvent):void
{
setChildIndex(evt.target as Sprite, 
numChildren-1);
}



On 27 Feb 2008, at 15:25, Cor wrote:

I made a minor adjustment because you have to typecast these  to a  
Sprite:



package
{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite
{
public function GreetingApp()
{
//var rectAndCircle:Shape = new Shape(); shape
changed to sprite to support mouse event
var rectAndCircle:Sprite = new Sprite();
//adding multiple shapes to a single Shape()
instance is akin to creating a graphic instance
rectAndCircle.graphics.lineStyle(10,0x99,1); //
draw lines around all rectAndCircle objects
rectAndCircle.graphics.beginFill(0xFF,1); // set
colour on object
rectAndCircle.graphics.drawRect(125,0,150,75); //
rectangle
rectAndCircle.graphics.beginFill(0xFF, 0.8); //
change colour on object
rectAndCircle.graphics.drawCircle(150,100,50); //
circle
rectAndCircle.x = 125;
rectAndCircle.y = 100;
//without this, rectAndCircle will not display
addChild(rectAndCircle);
//just for fun

rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m) as Sprite;

var triangle:Sprite = new Sprite()
triangle.graphics.beginFill(0xFF5500,0.8);
triangle.graphics.moveTo(50,0);
triangle.graphics.lineTo(100,100);
triangle.graphics.lineTo(0,100);
triangle.graphics.lineTo(50,0);
triangle.graphics.endFill();
triangle.x = 175;
triangle.y = 75;
addChildAt(triangle, getChildIndex(rectAndCircle));
// puts triangle BELOW rectAndCircle
triangle.addEventListener(MouseEvent.MOUSE_OVER,m)
as Sprite;

function m(e:MouseEvent):void
{
trace(this);
//setChildIndex(this, numChildren-1);
//doesn't work - 'this' is scoped to the holding object
trace(e);
}

var greeting_txt:TextField = new TextField();
greeting_txt.text = "hello world";
greeting_txt.x = 200;
greeting_txt.y = 300;
addChild(greeting_txt);
}
}
}


-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Allandt
Bik-Elliott (Receptacle)
Verzonden: woensdag 27 februari 2008 15:58
Aan: flashcoders
Onderwerp: [Flashcoders] quick scoping question

hi guys

i'm playing with some as3 to get my head around it and i've come  
across a
little wierdness in the drawing api that i hope you can shed some  
light on


here is my script - it's an amended version of one from Essential
Actionscript:



package com.receptacle.drawingtest
{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite
{
public function GreetingApp()
{
//var rectAndCircle:Shape = new Shape(); shape
changed to sprite to support mouse event
var rectAndCircle:Sprite = new Sprite();
//adding multiple shapes to a single Shape()
instance is akin to creating a graphic instance
rectAndCircle.graphics.lineStyle(10,0x99,1); //
draw lines around all rectAndCircle objects
rectAndCircle.graphics.beginFill(0xFF,1); // set
colour on object
rectAndCircle.graphics.drawRect(125,0,150,75); //
rectangle
rectAndCircle.graphics.beginFill(0xFF, 0.8); //
change colour on object
rectAndCircle.graphics.drawCircle(150,100,50); //
circle
rectAndCircle.x = 125;
rectAndCircle.y = 100;
//without this, rectAndCircle will not display
addChild(rectAndCircle);
//just for fun

rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m);

var triangle:Sprite = new Sprite()
triangle.g

Re: [Flashcoders] quick scoping question

2008-02-27 Thread Allandt Bik-Elliott (Receptacle)

thanks for the input, Cor...

hmmm didn't work for me



On 27 Feb 2008, at 15:25, Cor wrote:

I made a minor adjustment because you have to typecast these  to a  
Sprite:



package
{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite
{
public function GreetingApp()
{
//var rectAndCircle:Shape = new Shape(); shape
changed to sprite to support mouse event
var rectAndCircle:Sprite = new Sprite();
//adding multiple shapes to a single Shape()
instance is akin to creating a graphic instance
rectAndCircle.graphics.lineStyle(10,0x99,1); //
draw lines around all rectAndCircle objects
rectAndCircle.graphics.beginFill(0xFF,1); // set
colour on object
rectAndCircle.graphics.drawRect(125,0,150,75); //
rectangle
rectAndCircle.graphics.beginFill(0xFF, 0.8); //
change colour on object
rectAndCircle.graphics.drawCircle(150,100,50); //
circle
rectAndCircle.x = 125;
rectAndCircle.y = 100;
//without this, rectAndCircle will not display
addChild(rectAndCircle);
//just for fun

rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m) as Sprite;

var triangle:Sprite = new Sprite()
triangle.graphics.beginFill(0xFF5500,0.8);
triangle.graphics.moveTo(50,0);
triangle.graphics.lineTo(100,100);
triangle.graphics.lineTo(0,100);
triangle.graphics.lineTo(50,0);
triangle.graphics.endFill();
triangle.x = 175;
triangle.y = 75;
addChildAt(triangle, getChildIndex(rectAndCircle));
// puts triangle BELOW rectAndCircle
triangle.addEventListener(MouseEvent.MOUSE_OVER,m)
as Sprite;

function m(e:MouseEvent):void
{
trace(this);
//setChildIndex(this, numChildren-1);
//doesn't work - 'this' is scoped to the holding object
trace(e);
}

var greeting_txt:TextField = new TextField();
greeting_txt.text = "hello world";
greeting_txt.x = 200;
greeting_txt.y = 300;
addChild(greeting_txt);
}
}
}


-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Allandt
Bik-Elliott (Receptacle)
Verzonden: woensdag 27 februari 2008 15:58
Aan: flashcoders
Onderwerp: [Flashcoders] quick scoping question

hi guys

i'm playing with some as3 to get my head around it and i've come  
across a
little wierdness in the drawing api that i hope you can shed some  
light on


here is my script - it's an amended version of one from Essential
Actionscript:



package com.receptacle.drawingtest
{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite
{
public function GreetingApp()
{
//var rectAndCircle:Shape = new Shape(); shape
changed to sprite to support mouse event
var rectAndCircle:Sprite = new Sprite();
//adding multiple shapes to a single Shape()
instance is akin to creating a graphic instance
rectAndCircle.graphics.lineStyle(10,0x99,1); //
draw lines around all rectAndCircle objects
rectAndCircle.graphics.beginFill(0xFF,1); // set
colour on object
rectAndCircle.graphics.drawRect(125,0,150,75); //
rectangle
rectAndCircle.graphics.beginFill(0xFF, 0.8); //
change colour on object
rectAndCircle.graphics.drawCircle(150,100,50); //
circle
rectAndCircle.x = 125;
rectAndCircle.y = 100;
//without this, rectAndCircle will not display
addChild(rectAndCircle);
//just for fun

rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m);

var triangle:Sprite = new Sprite()
triangle.graphics.beginFill(0xFF5500,0.8);
triangle.graphics.moveTo(50,0);
triangle.graphics.lineTo(100,100);
  

RE: [Flashcoders] quick scoping question

2008-02-27 Thread Cor
Yes, I see.
Sorry, I misunderstood. 

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Allandt
Bik-Elliott (Receptacle)
Verzonden: woensdag 27 februari 2008 16:53
Aan: Flash Coders List
Onderwerp: Re: [Flashcoders] quick scoping question

i've amended my function to be

function m(evt:MouseEvent):void
{
setChildIndex(DisplayObject(evt.target),
numChildren-1);
}


which works but forcing the object type seems a bit hacky to me and doesn't
really teach me anything


On 27 Feb 2008, at 14:58, Allandt Bik-Elliott (Receptacle) wrote:

> hi guys
>
> i'm playing with some as3 to get my head around it and i've come 
> across a little wierdness in the drawing api that i hope you can shed 
> some light on
>
> here is my script - it's an amended version of one from Essential
> Actionscript:
>
> 
>
> package com.receptacle.drawingtest
> {
>   import flash.display.*;
>   import flash.text.TextField;
>   import flash.events.MouseEvent;
>   
>   public class GreetingApp extends Sprite
>   {
>   public function GreetingApp()
>   {
>   //var rectAndCircle:Shape = new Shape(); shape
changed to sprite to 
> support mouse event
>   var rectAndCircle:Sprite = new Sprite();
>   //adding multiple shapes to a single Shape()
instance is akin to 
> creating a graphic instance
>   rectAndCircle.graphics.lineStyle(10,0x99,1); //
draw lines 
> around all rectAndCircle objects
>   rectAndCircle.graphics.beginFill(0xFF,1); // set
colour on 
> object
>   rectAndCircle.graphics.drawRect(125,0,150,75); //
rectangle
>   rectAndCircle.graphics.beginFill(0xFF, 0.8); //
change colour 
> on object
>   rectAndCircle.graphics.drawCircle(150,100,50); //
circle
>   rectAndCircle.x = 125;
>   rectAndCircle.y = 100;
>   //without this, rectAndCircle will not display
>   addChild(rectAndCircle);
>   //just for fun
>
rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m);
>
>   var triangle:Sprite = new Sprite()
>   triangle.graphics.beginFill(0xFF5500,0.8);
>   triangle.graphics.moveTo(50,0);
>   triangle.graphics.lineTo(100,100);
>   triangle.graphics.lineTo(0,100);
>   triangle.graphics.lineTo(50,0);
>   triangle.graphics.endFill();
>   triangle.x = 175;
>   triangle.y = 75;
>   addChildAt(triangle, getChildIndex(rectAndCircle));
// puts 
> triangle BELOW rectAndCircle
>   triangle.addEventListener(MouseEvent.MOUSE_OVER,m);
>   
>   function m(event:MouseEvent):void
>   {
>   setChildIndex(this, numChildren-1);
//doesn't work - 'this' is 
> scoped to the holding object
>   }
>   
>   var greeting_txt:TextField = new TextField();
>   greeting_txt.text = "hello world";
>   greeting_txt.x = 200;
>   greeting_txt.y = 300;
>   addChild(greeting_txt);
>   }
>   }
> }
>
> 
>
> is what i've done possible? ie can i set a single mouseListener method 
> (m in my example) to be used by any of the sprites to move themselves 
> to the front of the display stack or would i have to write an explicit 
> statement for each one?
>
> thanks for your time
> a
>
>
>
> ___
> 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


--
No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.1/1300 - Release Date: 26-2-2008
19:50


No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.1/1300 - Release Date: 26-2-2008
19:50
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.1/1300 - Release Date: 26-2-2008
19:50
 

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


Re: [Flashcoders] quick scoping question

2008-02-27 Thread Allandt Bik-Elliott (Receptacle)

i've amended my function to be

function m(evt:MouseEvent):void
{
setChildIndex(DisplayObject(evt.target), 
numChildren-1);
}


which works but forcing the object type seems a bit hacky to me and  
doesn't really teach me anything



On 27 Feb 2008, at 14:58, Allandt Bik-Elliott (Receptacle) wrote:


hi guys

i'm playing with some as3 to get my head around it and i've come  
across a little wierdness in the drawing api that i hope you can  
shed some light on


here is my script - it's an amended version of one from Essential  
Actionscript:




package com.receptacle.drawingtest
{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite
{
public function GreetingApp()
{
			//var rectAndCircle:Shape = new Shape(); shape changed to sprite  
to support mouse event

var rectAndCircle:Sprite = new Sprite();
			//adding multiple shapes to a single Shape() instance is akin to  
creating a graphic instance
			rectAndCircle.graphics.lineStyle(10,0x99,1); // draw lines  
around all rectAndCircle objects
			rectAndCircle.graphics.beginFill(0xFF,1); // set colour on  
object

rectAndCircle.graphics.drawRect(125,0,150,75); // 
rectangle
			rectAndCircle.graphics.beginFill(0xFF, 0.8); // change  
colour on object

rectAndCircle.graphics.drawCircle(150,100,50); // circle
rectAndCircle.x = 125;
rectAndCircle.y = 100;
//without this, rectAndCircle will not display
addChild(rectAndCircle);
//just for fun
rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m);

var triangle:Sprite = new Sprite()
triangle.graphics.beginFill(0xFF5500,0.8);
triangle.graphics.moveTo(50,0);
triangle.graphics.lineTo(100,100);
triangle.graphics.lineTo(0,100);
triangle.graphics.lineTo(50,0);
triangle.graphics.endFill();
triangle.x = 175;
triangle.y = 75;
			addChildAt(triangle, getChildIndex(rectAndCircle)); // puts  
triangle BELOW rectAndCircle

triangle.addEventListener(MouseEvent.MOUSE_OVER,m);

function m(event:MouseEvent):void
{
setChildIndex(this, numChildren-1); //doesn't work - 'this' is  
scoped to the holding object

}

var greeting_txt:TextField = new TextField();
greeting_txt.text = "hello world";
greeting_txt.x = 200;
greeting_txt.y = 300;
addChild(greeting_txt);
}
}
}



is what i've done possible? ie can i set a single mouseListener  
method (m in my example) to be used by any of the sprites to move  
themselves to the front of the display stack or would i have to  
write an explicit statement for each one?


thanks for your time
a



___
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] quick scoping question

2008-02-27 Thread Cor
I made a minor adjustment because you have to typecast these  to a Sprite:


package
{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite
{
public function GreetingApp()
{
//var rectAndCircle:Shape = new Shape(); shape
changed to sprite to support mouse event
var rectAndCircle:Sprite = new Sprite();
//adding multiple shapes to a single Shape()
instance is akin to creating a graphic instance
rectAndCircle.graphics.lineStyle(10,0x99,1); //
draw lines around all rectAndCircle objects
rectAndCircle.graphics.beginFill(0xFF,1); // set
colour on object
rectAndCircle.graphics.drawRect(125,0,150,75); //
rectangle
rectAndCircle.graphics.beginFill(0xFF, 0.8); //
change colour on object
rectAndCircle.graphics.drawCircle(150,100,50); //
circle
rectAndCircle.x = 125;
rectAndCircle.y = 100;
//without this, rectAndCircle will not display
addChild(rectAndCircle);
//just for fun

rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m) as Sprite;

var triangle:Sprite = new Sprite()
triangle.graphics.beginFill(0xFF5500,0.8);
triangle.graphics.moveTo(50,0);
triangle.graphics.lineTo(100,100);
triangle.graphics.lineTo(0,100);
triangle.graphics.lineTo(50,0);
triangle.graphics.endFill();
triangle.x = 175;
triangle.y = 75;
addChildAt(triangle, getChildIndex(rectAndCircle));
// puts triangle BELOW rectAndCircle
triangle.addEventListener(MouseEvent.MOUSE_OVER,m)
as Sprite;

function m(e:MouseEvent):void
{
trace(this);
//setChildIndex(this, numChildren-1);
//doesn't work - 'this' is scoped to the holding object
trace(e);
}

var greeting_txt:TextField = new TextField();
greeting_txt.text = "hello world";
greeting_txt.x = 200;
greeting_txt.y = 300;
addChild(greeting_txt);
}
}
}


-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Allandt
Bik-Elliott (Receptacle)
Verzonden: woensdag 27 februari 2008 15:58
Aan: flashcoders
Onderwerp: [Flashcoders] quick scoping question

hi guys

i'm playing with some as3 to get my head around it and i've come across a
little wierdness in the drawing api that i hope you can shed some light on

here is my script - it's an amended version of one from Essential
Actionscript:



package com.receptacle.drawingtest
{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite
{
public function GreetingApp()
{
//var rectAndCircle:Shape = new Shape(); shape
changed to sprite to support mouse event
var rectAndCircle:Sprite = new Sprite();
//adding multiple shapes to a single Shape()
instance is akin to creating a graphic instance
rectAndCircle.graphics.lineStyle(10,0x99,1); //
draw lines around all rectAndCircle objects
rectAndCircle.graphics.beginFill(0xFF,1); // set
colour on object
rectAndCircle.graphics.drawRect(125,0,150,75); //
rectangle
rectAndCircle.graphics.beginFill(0xFF, 0.8); //
change colour on object
rectAndCircle.graphics.drawCircle(150,100,50); //
circle
rectAndCircle.x = 125;
rectAndCircle.y = 100;
//without this, rectAndCircle will not display
addChild(rectAndCircle);
//just for fun

rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m);

var triangle:Sprite = new Sprite()
triangle.graphics.beginFill(0xFF5500,0.8);
triangle.graphics.moveTo(50,0);
triangle.graphics.lineTo(100,100);
triangle.graphics.lineTo(0,100);
triangle.graphics.lineTo(50,0);
 

RE: [Flashcoders] quick scoping question

2008-02-27 Thread Cor
Yes, you can.
But you are referring to THIS and that is the class instance.
So use the .target property of the object send by the mouse event.

HTH

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Allandt
Bik-Elliott (Receptacle)
Verzonden: woensdag 27 februari 2008 15:58
Aan: flashcoders
Onderwerp: [Flashcoders] quick scoping question

hi guys

i'm playing with some as3 to get my head around it and i've come across a
little wierdness in the drawing api that i hope you can shed some light on

here is my script - it's an amended version of one from Essential
Actionscript:



package com.receptacle.drawingtest
{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite
{
public function GreetingApp()
{
//var rectAndCircle:Shape = new Shape(); shape
changed to sprite to support mouse event
var rectAndCircle:Sprite = new Sprite();
//adding multiple shapes to a single Shape()
instance is akin to creating a graphic instance
rectAndCircle.graphics.lineStyle(10,0x99,1); //
draw lines around all rectAndCircle objects
rectAndCircle.graphics.beginFill(0xFF,1); // set
colour on object
rectAndCircle.graphics.drawRect(125,0,150,75); //
rectangle
rectAndCircle.graphics.beginFill(0xFF, 0.8); //
change colour on object
rectAndCircle.graphics.drawCircle(150,100,50); //
circle
rectAndCircle.x = 125;
rectAndCircle.y = 100;
//without this, rectAndCircle will not display
addChild(rectAndCircle);
//just for fun

rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m);

var triangle:Sprite = new Sprite()
triangle.graphics.beginFill(0xFF5500,0.8);
triangle.graphics.moveTo(50,0);
triangle.graphics.lineTo(100,100);
triangle.graphics.lineTo(0,100);
triangle.graphics.lineTo(50,0);
triangle.graphics.endFill();
triangle.x = 175;
triangle.y = 75;
addChildAt(triangle, getChildIndex(rectAndCircle));
// puts triangle BELOW rectAndCircle
triangle.addEventListener(MouseEvent.MOUSE_OVER,m);

function m(event:MouseEvent):void
{
setChildIndex(this, numChildren-1);
//doesn't work - 'this' is scoped to the holding object
}

var greeting_txt:TextField = new TextField();
greeting_txt.text = "hello world";
greeting_txt.x = 200;
greeting_txt.y = 300;
addChild(greeting_txt);
}
}
}



is what i've done possible? ie can i set a single mouseListener method (m in
my example) to be used by any of the sprites to move themselves to the front
of the display stack or would i have to write an explicit statement for each
one?

thanks for your time
a



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


--
No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.1/1300 - Release Date: 26-2-2008
19:50


No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.1/1300 - Release Date: 26-2-2008
19:50
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.1/1300 - Release Date: 26-2-2008
19:50
 

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


Re: [Flashcoders] Flex Disables Browser Scrollbars?

2008-02-27 Thread EECOLOR
I think a better answer will be given on the flexcoders mailing list.

Greetz Erik

On 2/27/08, Elia Morling <[EMAIL PROTECTED]> wrote:
>
> How do I make it so that the html that flex generates doesn't disable the
> browser scrollbards?
> I have located the lines of html code that does this, but it's tedious to
> manually change them.
>
> Thanks
> Elia
> _
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Flex only generates errors for my Document Class, but not in any other AS file

2008-02-27 Thread EECOLOR
Make sure your classes are referenced from your document class.


Greetz Erik


On 2/26/08, Johan Nyberg <[EMAIL PROTECTED]> wrote:
>
> Hi, I was wondering if anyone has encountered this problem: I use Flex
> as an IDE when developing flash. When I code, Flex only displays
> errors in my document class, but not in any other AS file. Do I have
> to set something in the settings?
>
> Regards,
>
> Johan Nyberg
> Designer and web developer
>
> [EMAIL PROTECTED]
> 08 - 50 00 24 30
> 070 - 407 83 00
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] quick scoping question

2008-02-27 Thread Allandt Bik-Elliott (Receptacle)

hi guys

i'm playing with some as3 to get my head around it and i've come  
across a little wierdness in the drawing api that i hope you can shed  
some light on


here is my script - it's an amended version of one from Essential  
Actionscript:




package com.receptacle.drawingtest
{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite
{
public function GreetingApp()
{
			//var rectAndCircle:Shape = new Shape(); shape changed to sprite  
to support mouse event

var rectAndCircle:Sprite = new Sprite();
			//adding multiple shapes to a single Shape() instance is akin to  
creating a graphic instance
			rectAndCircle.graphics.lineStyle(10,0x99,1); // draw lines  
around all rectAndCircle objects

rectAndCircle.graphics.beginFill(0xFF,1); // set 
colour on object
rectAndCircle.graphics.drawRect(125,0,150,75); // 
rectangle
			rectAndCircle.graphics.beginFill(0xFF, 0.8); // change colour  
on object

rectAndCircle.graphics.drawCircle(150,100,50); // circle
rectAndCircle.x = 125;
rectAndCircle.y = 100;
//without this, rectAndCircle will not display
addChild(rectAndCircle);
//just for fun
rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m);

var triangle:Sprite = new Sprite()
triangle.graphics.beginFill(0xFF5500,0.8);
triangle.graphics.moveTo(50,0);
triangle.graphics.lineTo(100,100);
triangle.graphics.lineTo(0,100);
triangle.graphics.lineTo(50,0);
triangle.graphics.endFill();
triangle.x = 175;
triangle.y = 75;
			addChildAt(triangle, getChildIndex(rectAndCircle)); // puts  
triangle BELOW rectAndCircle

triangle.addEventListener(MouseEvent.MOUSE_OVER,m);

function m(event:MouseEvent):void
{
setChildIndex(this, numChildren-1); //doesn't work - 'this' is  
scoped to the holding object

}

var greeting_txt:TextField = new TextField();
greeting_txt.text = "hello world";
greeting_txt.x = 200;
greeting_txt.y = 300;
addChild(greeting_txt);
}
}
}



is what i've done possible? ie can i set a single mouseListener  
method (m in my example) to be used by any of the sprites to move  
themselves to the front of the display stack or would i have to write  
an explicit statement for each one?


thanks for your time
a



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


[Flashcoders] BitmapData.paletteMap ()

2008-02-27 Thread Elia Morling

As indicated in earlier post I need to swap the palettes of a bitmapdata.

"public function paletteMap(sourceBitmapData:BitmapData, 
sourceRect:Rectangle, destPoint:Point, redArray:Array = null, 
greenArray:Array = null, blueArray:Array = null, alphaArray:Array = 
null):void
Remaps the color channel values in an image that has up to four arrays of 
color palette data, one for each channel."


That is excellent, but how do I extract the current color channel values as 
arrays so that I can maniuplate them?


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


[Flashcoders] Flex Disables Browser Scrollbars?

2008-02-27 Thread Elia Morling
How do I make it so that the html that flex generates doesn't disable the 
browser scrollbards?
I have located the lines of html code that does this, but it's tedious to 
manually change them.


Thanks
Elia 
___

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


Re: [Flashcoders] AIR publishing problems

2008-02-27 Thread Charles Parcell
The answer to your question is what this article is all about.

http://www.adobe.com/devnet/air/flash/articles/air_flash_developers.html

Charles P.


On Tue, Feb 26, 2008 at 4:21 PM, dave matthews <
[EMAIL PROTECTED]> wrote:

>
> hi All,
>
>  FlashCS3 with the newly released AIR additions installed wants a
> 'descriptor file'!
>
>  Ah, what is this and why didn't Flash make one when the special Air
> publish tool is used?
>
> thanks,
> Dave_Matthews
> _
> Climb to the top of the charts! Play the word scramble challenge with star
> power.
>
> http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan___
> 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] Re: RangeError: Error #2006: The supplied index is out of bounds.

2008-02-27 Thread EECOLOR
You can use numChildren to check how many children a DisplayObjectContainer
has.


Greetz Erik

On 2/26/08, anuj sharma <[EMAIL PROTECTED]> wrote:
>
> I will loop it and see what will happen
> Thanks a lot for all your help
>
> Anuj
>
>
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders