[Flashcoders] Question on removeEventListener and Delegate callback

2007-05-08 Thread Jiri Heitlager | dadata.org

Hello List,

I was wondering if I am doing something correctly when adding listeners
to objects. My question is, if I remove the listener is the code below
then the right way. Do I use the Proxy class (or mx.utils.Delegate) also
when I remove the listener??

//adding a listener
this.currentDisplayObject.addEventListener('onContentCleared' ,
utils.Proxy.create(this ,  onBlockContentDestoyed , 'text ' , url))

//removing it
this.currentDisplayObject.removeEventListener('onContentCleared' ,
utils.Proxy.create(this ,  onBlockContentDestoyed))

Thank you

Jiri


John Trentini wrote:

Hi guys,


I want to create as many text fields (which eventually I would like to 
turn into buttons) as the length of an array. I also want to use the 
content of the array to populate the text of the fields created 
dynamically. I have tried everything I know but all I seem to get is 
one filed with the lasat item in the array, sheesh!


I've gone absolutely mad on this one (newish to actionScript, I am!) but 
can anyone tell me what  I am doing wrong here? I could do with a 
helping hand or seven =:-)




var myTxt:Array = new Array(branding, news, about us, print, 
marks, contact);

var myX = 430;
var menuArray:Array = new Array();
var ySpacing:Number = 90;
//

/*create  textFields**/
//
//

for(i=0; imyTxt.length; i++) {
   _root.createTextField(mytext+[i], 1, myX, 0, 100, 30);
   myId = _root[mytext+[i]];
   myId._y = ySpacing;
   ySpacing += 40;
   //  trace(myTxt[i]);//the trace works, it list 
all tyhe lements in the array but
   myId.text = myTxt[i];  // this one in not producing the appropriate 
results

   //
   myId.border = false;
   myformat = new TextFormat();
   myformat.font = Verdana;
   myformat.size = 14;
   myformat.bold = true;
   myformat.color = 0x55;
   myformat.align = right;
   //
   myId.selectable = false;
   myId.setTextFormat(myformat);
   //myId.text = myTxt[i];  //tried putting it at the end but no dah!
   //
}
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com




___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Question on removeEventListener and Delegate callback

2007-05-08 Thread Jiri Heitlager | dadata.org

I was wondering if I am doing something correctly when adding listeners
to objects. My question is, if I remove the listener is the code below
then the right way. Do I use the Proxy class (or mx.utils.Delegate) also
when I remove the listener??

//adding a listener
this.currentDisplayObject.addEventListener('onContentCleared' ,
utils.Proxy.create(this ,  onBlockContentDestoyed , 'text ' , url))

//removing it
this.currentDisplayObject.removeEventListener('onContentCleared' ,
utils.Proxy.create(this ,  onBlockContentDestoyed))

Thank you

Jiri

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Question on removeEventListener and Delegate callback

2007-05-08 Thread R�kos Attila

Why do you post the same question 4 times and with two different
subjects? I (and others) already answered your question yesterday.

  Attila


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Question on removeEventListener and Delegate callback

2007-05-07 Thread Jiri Heitlager | dadata.org
I was wondering if I am doing something correctly when adding listeners 
to objects. My question is, if I remove the listener is the code below 
then the right way. Do I use the Proxy class (or mx.utils.Delegate) also 
when I remove the listener??


//adding a listener
this.currentDisplayObject.addEventListener('onContentCleared' , 
utils.Proxy.create(this ,  onBlockContentDestoyed , 'text ' , url))


//removing it
this.currentDisplayObject.removeEventListener('onContentCleared' , 
utils.Proxy.create(this ,  onBlockContentDestoyed))


Thank you

Jiri


John Trentini wrote:

Hi guys,


I want to create as many text fields (which eventually I would like to 
turn into buttons) as the length of an array. I also want to use the 
content of the array to populate the text of the fields created 
dynamically. I have tried everything I know but all I seem to get is 
one filed with the lasat item in the array, sheesh!


I've gone absolutely mad on this one (newish to actionScript, I am!) but 
can anyone tell me what  I am doing wrong here? I could do with a 
helping hand or seven =:-)




var myTxt:Array = new Array(branding, news, about us, print, 
marks, contact);

var myX = 430;
var menuArray:Array = new Array();
var ySpacing:Number = 90;
//

/*create  textFields**/
//
//

for(i=0; imyTxt.length; i++) {
   _root.createTextField(mytext+[i], 1, myX, 0, 100, 30);
   myId = _root[mytext+[i]];
   myId._y = ySpacing;
   ySpacing += 40;
   //  trace(myTxt[i]);//the trace works, it list 
all tyhe lements in the array but
   myId.text = myTxt[i];  // this one in not producing the appropriate 
results

   //
   myId.border = false;
   myformat = new TextFormat();
   myformat.font = Verdana;
   myformat.size = 14;
   myformat.bold = true;
   myformat.color = 0x55;
   myformat.align = right;
   //
   myId.selectable = false;
   myId.setTextFormat(myformat);
   //myId.text = myTxt[i];  //tried putting it at the end but no dah!
   //
}
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Question on removeEventListener and Delegate callback

2007-05-07 Thread R�kos Attila

I don't know what does your utils.Proxy.create() method do exactly,
but mx.utils.Delegate.create() always returns a new Function instance,
thus it cannot be used directly in removeEventListener() calls. Store
the function reference passed to addEventListener and use it in
removeEventListener(), too:

myEventHandler = mx.utils.Delegate.create(this, onMyEvent);
foo.addEventListener('myEvent', myEventHandler);

...

foo.removeEventListener('myEvent', myEventHandler);

If your Proxy class takes care about always returning the same
Function instance for the same arguments (I doubt it), then you can
use it as you wrote.

  Attila

JHdo I was wondering if I am doing something correctly when adding listeners
JHdo to objects. My question is, if I remove the listener is the code below 
JHdo then the right way. Do I use the Proxy class (or mx.utils.Delegate) also 
JHdo when I remove the listener??
JHdo 
JHdo //adding a listener
JHdo this.currentDisplayObject.addEventListener('onContentCleared' , 
JHdo utils.Proxy.create(this ,  onBlockContentDestoyed , 'text ' , url))
JHdo 
JHdo //removing it
JHdo this.currentDisplayObject.removeEventListener('onContentCleared' , 
JHdo utils.Proxy.create(this ,  onBlockContentDestoyed))


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Question on removeEventListener and Delegate callback

2007-05-07 Thread eka

Hello :)

use a variable to register your virtual proxy function :

var listener = utils.Proxy.create(this ,  onBlockContentDestoyed , 'text ' ,
url) ;

this.currentDisplayObject.addEventListener('onContentCleared' , listener ) ;

//removing it

this.currentDisplayObject.removeEventListener('onContentCleared' , listener
) ;

Now you can keep the variable in memory ;)

PS : if you want use a better event model, you can try my event model in my
opensource framework VEGAS : http://code.google.com/p/vegas

Install VEGAS : http://code.google.com/p/vegas/wiki/InstallVEGASwithSVN
Read the tutorials about the W3C event model :
http://code.google.com/p/vegas/wiki/VegasTutorialsEvents

For me .. it's more easy with this implementation.

eKA+ :)



2007/5/7, Jiri Heitlager | dadata.org [EMAIL PROTECTED]:


I was wondering if I am doing something correctly when adding listeners
to objects. My question is, if I remove the listener is the code below
then the right way. Do I use the Proxy class (or mx.utils.Delegate) also
when I remove the listener??

//adding a listener
this.currentDisplayObject.addEventListener('onContentCleared' ,
utils.Proxy.create(this ,  onBlockContentDestoyed , 'text ' , url))

//removing it
this.currentDisplayObject.removeEventListener('onContentCleared' ,
utils.Proxy.create(this ,  onBlockContentDestoyed))

Thank you

Jiri


John Trentini wrote:
 Hi guys,


 I want to create as many text fields (which eventually I would like to
 turn into buttons) as the length of an array. I also want to use the
 content of the array to populate the text of the fields created
 dynamically. I have tried everything I know but all I seem to get is
 one filed with the lasat item in the array, sheesh!

 I've gone absolutely mad on this one (newish to actionScript, I am!) but
 can anyone tell me what  I am doing wrong here? I could do with a
 helping hand or seven =:-)



 var myTxt:Array = new Array(branding, news, about us, print,
 marks, contact);
 var myX = 430;
 var menuArray:Array = new Array();
 var ySpacing:Number = 90;
 //

 /*create  textFields**/
 //
 //

 for(i=0; imyTxt.length; i++) {
_root.createTextField(mytext+[i], 1, myX, 0, 100, 30);
myId = _root[mytext+[i]];
myId._y = ySpacing;
ySpacing += 40;
//  trace(myTxt[i]);//the trace works, it list
 all tyhe lements in the array but
myId.text = myTxt[i];  // this one in not producing the appropriate
 results
//
myId.border = false;
myformat = new TextFormat();
myformat.font = Verdana;
myformat.size = 14;
myformat.bold = true;
myformat.color = 0x55;
myformat.align = right;
//
myId.selectable = false;
myId.setTextFormat(myformat);
//myId.text = myTxt[i];  //tried putting it at the end but no dah!
//
 }
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com