Re: [Flashcoders] as3 image loading and reusing amongst classes. And listening to events fired by children.

2008-11-25 Thread Anthony Pace

I have done that , put when I pass the function...
newThumbNail(this.imageDataArray[this.imageDataArray.length-1]);

it still does not display my image as a thumbnail...  I have tested to 
see if it is receiving the image data, and it is; however, for some 
reason, I can't seem to put it on the display list.  I have added all 
children in order, and I am wondering what is going on.


private function onImageLoad(event:Event):void {
   var bmp:Bitmap = event.target.loader.content as Bitmap;
   this.imageDataArray[this.imageDataArray.length] = bmp;
   if (this.imageTotal == 0) {
   trace('we are getting this far');
   
this.BIPanel.newImage(this.imageDataArray[this.imageDataArray.length-1]);
   //this is the call to the first big image and it loads 
very well

   }
   
this.tPanel.newThumbNail(this.imageDataArray[this.imageDataArray.length-1], 
imageTotal);
  //now this seems to pass the data but the image 
is not displayed in the child class of thumbs panel

  //thumbnailPanel class thumbnail class.
  //yet, I have added everything as a child of it's parent.
}


it still does not show up; yet, the subClass method traces out the 
bitmap data that was sent.  What am I doing wrong?  I need an answer 
bad.  I used to be able to do this so easily in as2.





Cor wrote:

Put your bitmaps in a globally declared Array and they will be available at
all times.

-Original Message-
From: Anthony Pace [mailto:[EMAIL PROTECTED] 
Sent: dinsdag 25 november 2008 11:12

To: Cor
Subject: Re: [Flashcoders] as3 image loading and reusing amongst classes.
And listening to events fired by children.

Actually,

I thought I figured it out, and then it stopped working.  I was just 
duplicating the bitmap; yet, it doesn't seem to work anymore???  Maybe I 
messed up something...



Cor wrote:
  

Hi Anthony,

Good for you!
I live in The Netherlands (GMT+1) so I missed some hours in your progress.

Would you be so kind to share your solution?

Kind regards
Cor


-Original Message-
From: Anthony Pace [mailto:[EMAIL PROTECTED] 
Sent: dinsdag 25 november 2008 4:12

To: Cor
Subject: Re: [Flashcoders] as3 image loading and reusing amongst classes.
And listening to events fired by children.

Figured it out, and thanks for the help.

Cor wrote:
  

Just thinking about reparenting issues at this point, and your way is 
great if you record a depth variable and pass it back to a parent 
function which passes it back to a parent function etc... ;yet, what if 
my parent has changed and I don't have that function available to me 
anymore?  Is there some way of doing this


One addition: If you put your function in a class file (.as) they will
always be available, no matter what is on your stage.
Set this as your Document file and you are good to go.

Grz
Cor


  

  

No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.175 / Virus Database: 270.9.10/1810 - Release Date:


24-11-2008
  

14:36


  



No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.175 / Virus Database: 270.9.10/1810 - Release Date: 24-11-2008

14:36


  


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


Re: [Flashcoders] as3 image loading and reusing amongst classes. And listening to events fired by children.

2008-11-25 Thread Anthony Pace
I can trace out, and attach the child to the subclass and have it 
display the unformatted bmp,
so not only does my function work when passing the data, I have a 
starting point to test from.


What I am now wondering, is if it acts as a pointer to the original 
target, or of it duplicates the image...


public function newThumbNail(target:Bitmap, pos:uint) {
 //I am duplicating the data in case it is a pointer and not a 
newly instantiated object.

   var bmp:Bitmap = new Bitmap();
   bmp.bitmapData = target.bitmapData;

//addChild(bmp);  I was able to see the data when passed using 
this.
//the params for my new thumb constructor are just temporary... 
and they can be traced out from the subclass


   var tmb:thumb = new thumb(this.x, this.x, tmw, tmh);
   tmb.name = thumb + pos;
   tmb.newImage(bmp);
   this.thumbsContainer.addChildAt(tmb,pos);
   }
now when I want it to display the BMP in the thumb class... nothing 
happens...



Cor wrote:

Try to trace where you loose the scope of your bitmap.
Do you return it from your subclass??

-Original Message-
From: Anthony Pace [mailto:[EMAIL PROTECTED] 
Sent: dinsdag 25 november 2008 16:01

To: Cor; Flash Coders List
Subject: Re: [Flashcoders] as3 image loading and reusing amongst classes.
And listening to events fired by children.

I have done that , put when I pass the function...
newThumbNail(this.imageDataArray[this.imageDataArray.length-1]);

it still does not display my image as a thumbnail...  I have tested to 
see if it is receiving the image data, and it is; however, for some 
reason, I can't seem to put it on the display list.  I have added all 
children in order, and I am wondering what is going on.


private function onImageLoad(event:Event):void {
var bmp:Bitmap = event.target.loader.content as Bitmap;
this.imageDataArray[this.imageDataArray.length] = bmp;
if (this.imageTotal == 0) {
trace('we are getting this far');

this.BIPanel.newImage(this.imageDataArray[this.imageDataArray.length-1]);
//this is the call to the first big image and it loads 
very well

}

this.tPanel.newThumbNail(this.imageDataArray[this.imageDataArray.length-1], 
imageTotal);
   //now this seems to pass the data but the image 
is not displayed in the child class of thumbs panel

   //thumbnailPanel class thumbnail class.
   //yet, I have added everything as a child of it's parent.
}


it still does not show up; yet, the subClass method traces out the 
bitmap data that was sent.  What am I doing wrong?  I need an answer 
bad.  I used to be able to do this so easily in as2.





Cor wrote:
  

Put your bitmaps in a globally declared Array and they will be available


at
  

all times.

-Original Message-
From: Anthony Pace [mailto:[EMAIL PROTECTED] 
Sent: dinsdag 25 november 2008 11:12

To: Cor
Subject: Re: [Flashcoders] as3 image loading and reusing amongst classes.
And listening to events fired by children.

Actually,

I thought I figured it out, and then it stopped working.  I was just 
duplicating the bitmap; yet, it doesn't seem to work anymore???  Maybe I 
messed up something...



Cor wrote:
  


Hi Anthony,

Good for you!
I live in The Netherlands (GMT+1) so I missed some hours in your
  

progress.
  

Would you be so kind to share your solution?

Kind regards
Cor


-Original Message-
From: Anthony Pace [mailto:[EMAIL PROTECTED] 
Sent: dinsdag 25 november 2008 4:12

To: Cor
Subject: Re: [Flashcoders] as3 image loading and reusing amongst classes.
And listening to events fired by children.

Figured it out, and thanks for the help.

Cor wrote:
  

  
Just thinking about reparenting issues at this point, and your way is 
great if you record a depth variable and pass it back to a parent 
function which passes it back to a parent function etc... ;yet, what if 
my parent has changed and I don't have that function available to me 
anymore?  Is there some way of doing this


One addition: If you put your function in a class file (.as) they will
always be available, no matter what is on your stage.
Set this as your Document file and you are good to go.

Grz
Cor


  

  


No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.175 / Virus Database: 270.9.10/1810 - Release Date:

  

24-11-2008
  


14:36


  

  

No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.175 / Virus Database: 270.9.10/1810 - Release Date:


24-11-2008
  

14:36


  



No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.175 / Virus Database: 270.9.10/1810 - Release Date: 24-11-2008

14:36


  


___
Flashcoders mailing list

RE: [Flashcoders] as3 image loading and reusing amongst classes. And listening to events fired by children.

2008-11-25 Thread Steven . Penza
I think you need to draw the loaded bitmap data in a new BitmapData
instance. Something like this:

var bitmap:Bitmap = _loader.content;
var bitmapData:BitmapData = new BitmapData( bitmap.width, bitmap.height,
true, 0x );
var sprite:Sprite = new Sprite();
bitmapData.draw( bitmap.bitmapData );
sprite.addChild( new Bitmap( bitmapData ) );

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Anthony Pace
Sent: Tuesday, November 25, 2008 10:42 AM
To: Cor; Flash Coders List
Subject: Re: [Flashcoders] as3 image loading and reusing amongst classes.
And listening to events fired by children.

I can trace out, and attach the child to the subclass and have it 
display the unformatted bmp,
so not only does my function work when passing the data, I have a 
starting point to test from.

What I am now wondering, is if it acts as a pointer to the original 
target, or of it duplicates the image...

public function newThumbNail(target:Bitmap, pos:uint) {
  //I am duplicating the data in case it is a pointer and not a 
newly instantiated object.
var bmp:Bitmap = new Bitmap();
bmp.bitmapData = target.bitmapData;

 //addChild(bmp);  I was able to see the data when passed using 
this.
 //the params for my new thumb constructor are just temporary... 
and they can be traced out from the subclass

var tmb:thumb = new thumb(this.x, this.x, tmw, tmh);
tmb.name = thumb + pos;
tmb.newImage(bmp);
this.thumbsContainer.addChildAt(tmb,pos);
}
now when I want it to display the BMP in the thumb class... nothing 
happens...


Cor wrote:
 Try to trace where you loose the scope of your bitmap.
 Do you return it from your subclass??

 -Original Message-
 From: Anthony Pace [mailto:[EMAIL PROTECTED] 
 Sent: dinsdag 25 november 2008 16:01
 To: Cor; Flash Coders List
 Subject: Re: [Flashcoders] as3 image loading and reusing amongst classes.
 And listening to events fired by children.

 I have done that , put when I pass the function...
 newThumbNail(this.imageDataArray[this.imageDataArray.length-1]);

 it still does not display my image as a thumbnail...  I have tested to 
 see if it is receiving the image data, and it is; however, for some 
 reason, I can't seem to put it on the display list.  I have added all 
 children in order, and I am wondering what is going on.

 private function onImageLoad(event:Event):void {
 var bmp:Bitmap = event.target.loader.content as Bitmap;
 this.imageDataArray[this.imageDataArray.length] = bmp;
 if (this.imageTotal == 0) {
 trace('we are getting this far');
 
 this.BIPanel.newImage(this.imageDataArray[this.imageDataArray.length-1]);
 //this is the call to the first big image and it loads 
 very well
 }
 

this.tPanel.newThumbNail(this.imageDataArray[this.imageDataArray.length-1], 
 imageTotal);
//now this seems to pass the data but the image 
 is not displayed in the child class of thumbs panel
//thumbnailPanel class thumbnail class.
//yet, I have added everything as a child of it's parent.
 }


 it still does not show up; yet, the subClass method traces out the 
 bitmap data that was sent.  What am I doing wrong?  I need an answer 
 bad.  I used to be able to do this so easily in as2.




 Cor wrote:
   
 Put your bitmaps in a globally declared Array and they will be available
 
 at
   
 all times.

 -Original Message-
 From: Anthony Pace [mailto:[EMAIL PROTECTED] 
 Sent: dinsdag 25 november 2008 11:12
 To: Cor
 Subject: Re: [Flashcoders] as3 image loading and reusing amongst classes.
 And listening to events fired by children.

 Actually,

 I thought I figured it out, and then it stopped working.  I was just 
 duplicating the bitmap; yet, it doesn't seem to work anymore???  Maybe I 
 messed up something...


 Cor wrote:
   
 
 Hi Anthony,

 Good for you!
 I live in The Netherlands (GMT+1) so I missed some hours in your
   
 progress.
   
 Would you be so kind to share your solution?

 Kind regards
 Cor


 -Original Message-
 From: Anthony Pace [mailto:[EMAIL PROTECTED] 
 Sent: dinsdag 25 november 2008 4:12
 To: Cor
 Subject: Re: [Flashcoders] as3 image loading and reusing amongst
classes.
 And listening to events fired by children.

 Figured it out, and thanks for the help.

 Cor wrote:
   
 
   
 Just thinking about reparenting issues at this point, and your way is 
 great if you record a depth variable and pass it back to a parent 
 function which passes it back to a parent function etc... ;yet, what if

 my parent has changed and I don't have that function available to me 
 anymore?  Is there some way of doing this

 One addition: If you put your function in a class file (.as) they will
 always be available, no matter what is on your stage.
 Set this as 

Re: [Flashcoders] as3 image loading and reusing amongst classes. And listening to events fired by children.

2008-11-25 Thread Anthony Pace
I finally figured out what it was...  I had instantiated a variable of 
the same name and referenced that as a child

private var thumbsContainer:Sprite=new Sprite();

and in the constructor I also had

   var thumbsContainer:Sprite = new Sprite();
   this.addChild(thumbsContainer);

My gosh I am a moron sometimes.
  
I got rid of the top declaration and I am no longer experiencing 
problems.  This should take no time at all to finish coding, now that I 
figured it out.


Yet, I still need help with monitoring events fired by children... I 
know I can traverse backwards yet, I am looking for a better method and 
maybe a how to?



Cor wrote:

OK I think I now the problem.
You do this newThumbNail(this.imageDataArray[this.imageDataArray.length-1]);
But this does not set the pos parameter.
So every bmp is placed at index 0 or undefined if pos is never declared.

Does this help?

Kind regards
Cor

-Original Message-
From: Anthony Pace [mailto:[EMAIL PROTECTED] 
Sent: dinsdag 25 november 2008 16:42

To: Cor; Flash Coders List
Subject: Re: [Flashcoders] as3 image loading and reusing amongst classes.
And listening to events fired by children.

I can trace out, and attach the child to the subclass and have it 
display the unformatted bmp,
so not only does my function work when passing the data, I have a 
starting point to test from.


What I am now wondering, is if it acts as a pointer to the original 
target, or of it duplicates the image...


public function newThumbNail(target:Bitmap, pos:uint) {
  //I am duplicating the data in case it is a pointer and not a 
newly instantiated object.

var bmp:Bitmap = new Bitmap();
bmp.bitmapData = target.bitmapData;

 //addChild(bmp);  I was able to see the data when passed using 
this.
 //the params for my new thumb constructor are just temporary... 
and they can be traced out from the subclass


var tmb:thumb = new thumb(this.x, this.x, tmw, tmh);
tmb.name = thumb + pos;
tmb.newImage(bmp);
this.thumbsContainer.addChildAt(tmb,pos);
}
now when I want it to display the BMP in the thumb class... nothing 
happens...



Cor wrote:
  

Try to trace where you loose the scope of your bitmap.
Do you return it from your subclass??

-Original Message-
From: Anthony Pace [mailto:[EMAIL PROTECTED] 
Sent: dinsdag 25 november 2008 16:01

To: Cor; Flash Coders List
Subject: Re: [Flashcoders] as3 image loading and reusing amongst classes.
And listening to events fired by children.

I have done that , put when I pass the function...
newThumbNail(this.imageDataArray[this.imageDataArray.length-1]);

it still does not display my image as a thumbnail...  I have tested to 
see if it is receiving the image data, and it is; however, for some 
reason, I can't seem to put it on the display list.  I have added all 
children in order, and I am wondering what is going on.


private function onImageLoad(event:Event):void {
var bmp:Bitmap = event.target.loader.content as Bitmap;
this.imageDataArray[this.imageDataArray.length] = bmp;
if (this.imageTotal == 0) {
trace('we are getting this far');

this.BIPanel.newImage(this.imageDataArray[this.imageDataArray.length-1]);
//this is the call to the first big image and it loads 
very well

}



this.tPanel.newThumbNail(this.imageDataArray[this.imageDataArray.length-1], 
  

imageTotal);
   //now this seems to pass the data but the image 
is not displayed in the child class of thumbs panel

   //thumbnailPanel class thumbnail class.
   //yet, I have added everything as a child of it's parent.
}


it still does not show up; yet, the subClass method traces out the 
bitmap data that was sent.  What am I doing wrong?  I need an answer 
bad.  I used to be able to do this so easily in as2.





Cor wrote:
  


Put your bitmaps in a globally declared Array and they will be available

  

at
  


all times.

-Original Message-
From: Anthony Pace [mailto:[EMAIL PROTECTED] 
Sent: dinsdag 25 november 2008 11:12

To: Cor
Subject: Re: [Flashcoders] as3 image loading and reusing amongst classes.
And listening to events fired by children.

Actually,

I thought I figured it out, and then it stopped working.  I was just 
duplicating the bitmap; yet, it doesn't seem to work anymore???  Maybe I 
messed up something...



Cor wrote:
  

  

Hi Anthony,

Good for you!
I live in The Netherlands (GMT+1) so I missed some hours in your
  


progress.
  


Would you be so kind to share your solution?

Kind regards
Cor


-Original Message-
From: Anthony Pace [mailto:[EMAIL PROTECTED] 
Sent: dinsdag 25 november 2008 4:12

To: Cor
Subject: Re: [Flashcoders] as3 image loading and reusing amongst


classes.
  

And listening to events fired by children.


Re: [Flashcoders] as3 image loading and reusing amongst classes. And listening to events fired by children.

2008-11-25 Thread Anthony Pace
Are there restrictions on how far you can traverse downwards to add 
children from your class?... it seams I can't go beyond a specific point 
I experience very weird display related errors.


Thanks,
Anthony

Anthony Pace wrote:
OMG... I am having the problem again... this time I checked the 
variables to ensure I didn't make any errors in placement or calling a 
var of the same name; yet, I might have missed something.  I need to 
know what I am doing wrong...


last time it was a variable declaration...this time who know?  I 
traced out and it shows that the bitmap data is going to my thumbnail 
class; however, it is not being added


Am I not able to do the following?:

this.addChild(imageContainer);
this.imageContainer.addChild(image);

By the way you seem to know a lot about AS3 do you ever work in Canada?

Cor wrote:

Not exactly. You can use string references
var blah:Object = new Object();
blah[names] = [Anthony, Cor];
blah[countries] = [Canada, The Netherlands];

for (var person:String in blah){
trace(person + :  + blah[person]);
}


... call the GC manually if you know you are potentially running  out of
memory.

Yes, but then again, with 4 GB... :-)

... I would like is the ability to read memory addresses and adjust it
manually; yet, I know this would be a serious security issue.

There is a possibility to flush memory.
Never used it myself so I can't give you an example now.

...You said I can see a list of active listeners... how to? 
package flash.events{

public interface IEventDispatcher{
function addEventListener(eventName:String, 
listener:Object,

useCapture:Boolean=false,
priority:Integer=0,
useWeakReference:Boolean=false):Boolean;

function removeEventListener(eventName:String, 
listener:Object,

useCapture:Boolean=false):Boolean;

function dispatchEvent(eventObject:Event):Boolean;

function hasEventListener(eventName:String):Boolean;
function willTrigger(eventName:String):Boolean;
}
}


...I hear flash treats a lot of objects like pointers to speed up the
display, do you know if that is true?
Yes, this is correct.


  





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


Re: [Flashcoders] as3 image loading and reusing amongst classes. And listening to events fired by children.

2008-11-25 Thread Anthony Pace
OMG... its working again.  Is something up with my version of the 
player?  Is the debugger whacked?


It is doing exactly what I asked it to; yet, it only took my 12 times 
recompiling to get it to work... is it the flex SDK?  I didn't change 
one bit of code; yet, it works all of a sudden.


This is going to drive me nuts.

Thanks,
Anthony

Anthony Pace wrote:
Are there restrictions on how far you can traverse downwards to add 
children from your class?... it seams I can't go beyond a specific 
point I experience very weird display related errors.


Thanks,
Anthony

Anthony Pace wrote:
OMG... I am having the problem again... this time I checked the 
variables to ensure I didn't make any errors in placement or calling 
a var of the same name; yet, I might have missed something.  I need 
to know what I am doing wrong...


last time it was a variable declaration...this time who know?  I 
traced out and it shows that the bitmap data is going to my thumbnail 
class; however, it is not being added


Am I not able to do the following?:

this.addChild(imageContainer);
this.imageContainer.addChild(image);

By the way you seem to know a lot about AS3 do you ever work in Canada?

Cor wrote:

Not exactly. You can use string references
var blah:Object = new Object();
blah[names] = [Anthony, Cor];
blah[countries] = [Canada, The Netherlands];

for (var person:String in blah){
trace(person + :  + blah[person]);
}


... call the GC manually if you know you are potentially running  
out of

memory.

Yes, but then again, with 4 GB... :-)

... I would like is the ability to read memory addresses and adjust it
manually; yet, I know this would be a serious security issue.

There is a possibility to flush memory.
Never used it myself so I can't give you an example now.

...You said I can see a list of active listeners... how to? package 
flash.events{

public interface IEventDispatcher{
function addEventListener(eventName:String, 
listener:Object,

useCapture:Boolean=false,
priority:Integer=0,
useWeakReference:Boolean=false):Boolean;

function removeEventListener(eventName:String, 
listener:Object,

useCapture:Boolean=false):Boolean;

function dispatchEvent(eventObject:Event):Boolean;

function hasEventListener(eventName:String):Boolean;
function willTrigger(eventName:String):Boolean;
}
}


...I hear flash treats a lot of objects like pointers to speed up the
display, do you know if that is true?
Yes, this is correct.


  








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


Re: [Flashcoders] as3 image loading and reusing amongst classes. And listening to events fired by children.

2008-11-25 Thread Anthony Pace
And just in case someone asks... Yes everything is loading in well as I 
can trace to see all the objects and their properties as they are loaded.


well, now I have to figure out how to call a parent function without 
having to traverse or go global.  JOY


Thanks,
Anthony

Anthony Pace wrote:
OMG... its working again.  Is something up with my version of the 
player?  Is the debugger whacked?


It is doing exactly what I asked it to; yet, it only took my 12 times 
recompiling to get it to work... is it the flex SDK?  I didn't change 
one bit of code; yet, it works all of a sudden.


This is going to drive me nuts.

Thanks,
Anthony

Anthony Pace wrote:
Are there restrictions on how far you can traverse downwards to add 
children from your class?... it seams I can't go beyond a specific 
point I experience very weird display related errors.


Thanks,
Anthony

Anthony Pace wrote:
OMG... I am having the problem again... this time I checked the 
variables to ensure I didn't make any errors in placement or calling 
a var of the same name; yet, I might have missed something.  I need 
to know what I am doing wrong...


last time it was a variable declaration...this time who know?  I 
traced out and it shows that the bitmap data is going to my 
thumbnail class; however, it is not being added


Am I not able to do the following?:

this.addChild(imageContainer);
this.imageContainer.addChild(image);

By the way you seem to know a lot about AS3 do you ever work in Canada?

Cor wrote:

Not exactly. You can use string references
var blah:Object = new Object();
blah[names] = [Anthony, Cor];
blah[countries] = [Canada, The Netherlands];

for (var person:String in blah){
trace(person + :  + blah[person]);
}


... call the GC manually if you know you are potentially running  
out of

memory.

Yes, but then again, with 4 GB... :-)

... I would like is the ability to read memory addresses and adjust it
manually; yet, I know this would be a serious security issue.

There is a possibility to flush memory.
Never used it myself so I can't give you an example now.

...You said I can see a list of active listeners... how to? package 
flash.events{

public interface IEventDispatcher{
function addEventListener(eventName:String, 
listener:Object,

useCapture:Boolean=false,
priority:Integer=0,
useWeakReference:Boolean=false):Boolean;

function removeEventListener(eventName:String, 
listener:Object,

useCapture:Boolean=false):Boolean;

function dispatchEvent(eventObject:Event):Boolean;

function hasEventListener(eventName:String):Boolean;
function willTrigger(eventName:String):Boolean;
}
}


...I hear flash treats a lot of objects like pointers to speed up the
display, do you know if that is true?
Yes, this is correct.


  








___
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