[flexcoders] Problem flex 4

2011-09-22 Thread Aicha ..
Hi everybody
I have a problem with flex 4.5 that for component s:Group and s:Form
don't accept ths property label
how can i resole this problem
thx


[flexcoders] e4x help

2011-09-22 Thread michael_regert
I must be missing something simple here.  I'm reading in XML that looks like 
this:

?xml version=1.0 encoding=UTF-8?
REGISTRY
  REGISTRY_DECLARATION/
  REGISTRY_ENTRIES
Attribute
  AttributeNameAttr_1/AttributeName
/Attribute
Attribute
  AttributeNameAttr_2/AttributeName
/Attribute
Attribute
  AttributeNameAttr_3/AttributeName
/Attribute
  /REGISTRY_ENTRIES
/REGISTRY

I'm trying to get all Atribute nodes using the .. operator, but it always 
returns 0, even though xmlRoot looks fine.

protected function xmlService_resultHandler(event:ResultEvent):void
{
  if (event != null  event.result != null  event.result is XML) {
var xmlRoot:XML = event.result as XML;
if (xmlRoot  xmlRoot.length()  0) {
  var lst:XMLList = xmlRoot..Attribute;
  trace(lst length =  + lst.length());
}
  }
}


Michael



Re: [flexcoders] e4x help

2011-09-22 Thread Haykel BEN JEMIA
working for me. here is the code I used for testing:

package
{
import flash.display.Sprite;

public class Test extends Sprite
{
private var xmlRoot:XML =
REGISTRY
REGISTRY_DECLARATION/
REGISTRY_ENTRIES
Attribute
AttributeNameAttr_1/AttributeName
/Attribute
Attribute
AttributeNameAttr_2/AttributeName
/Attribute
Attribute
AttributeNameAttr_3/AttributeName
/Attribute
/REGISTRY_ENTRIES
/REGISTRY;

public function Test()
{
if (xmlRoot  xmlRoot.length()  0) {
var lst:XMLList = xmlRoot..Attribute;
trace(lst length =  + lst.length());
}
}
}
}

it outputs 'lst length = 3' as expected.

Haykel Ben Jemia

Allmas
Web  RIA Development
http://www.allmas-tn.com




On Thu, Sep 22, 2011 at 3:54 PM, michael_reg...@dell.com wrote:

 **


 I must be missing something simple here.  I’m reading in XML that looks
 like this:

 ** **

 ?*xml* version=1.0 encoding=UTF-8?

 REGISTRY

   REGISTRY_DECLARATION/

   REGISTRY_ENTRIES

 Attribute

   AttributeNameAttr_1/AttributeName

 /Attribute

 Attribute

   AttributeNameAttr_2/AttributeName

 /Attribute

 Attribute

   AttributeNameAttr_3/AttributeName

 /Attribute

   /REGISTRY_ENTRIES

 /REGISTRY

 ** **

 I’m trying to get all Atribute nodes using the .. operator, but it always
 returns 0, even though xmlRoot looks fine.  

 ** **

 *protected* *function* xmlService_resultHandler(event:ResultEvent):*void**
 ***

 {

   *if* (event != *null*  event.result != *null*  event.result 
 *is*XML) {
 

 *var* xmlRoot:XML = event.result *as* XML;

 *if* (xmlRoot  xmlRoot.length()  0) {

   *var* lst:XMLList = xmlRoot..Attribute;

   *trace*(*lst length = * + lst.length());

 }

   }

 }

 ** **

 ** **

 *Michael*

 ** **

  



RE: [flexcoders] e4x help

2011-09-22 Thread michael_regert
I guess I should have copied the entire XML.

REGISTRY xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
xsi:schemaLocation=http://schemas.dell.com/wbem/biosattributeregistry/1 
file:///C:/work/12G/Attribute%20Registry/DCIM_AttributeRegistry.xsd 
xmlns=http://schemas.dell.com/wbem/biosattributeregistry/1;

Turns out if I just remove the last namespace, 
xmlns=http://schemas.dell.com/wbem/biosattributeregistry/1;

Then it works correctly.

Any idea why this would cause it to not be able to find the children?

Michael J. Regert

Please consider the environment before printing this email.

Confidentiality Notice | This e-mail message, including any attachments, is for 
the sole use of the intended recipient(s) and may contain confidential or 
proprietary information. Any unauthorized review, use, disclosure or 
distribution is prohibited. If you are not the intended recipient, immediately 
contact the sender by reply e-mail and destroy all copies of the original 
message.


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf 
Of Brendan Meutzner
Sent: Thursday, September 22, 2011 10:20 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] e4x help



You shouldn't do a check on the length() for xmlRoot... that represents the 
REGISTRY level... otherwise your code looks fine.


On Thu, Sep 22, 2011 at 4:54 PM, 
michael_reg...@dell.commailto:michael_reg...@dell.com wrote:

I must be missing something simple here.  I’m reading in XML that looks like 
this:

?xml version=1.0 encoding=UTF-8?
REGISTRY
  REGISTRY_DECLARATION/
  REGISTRY_ENTRIES
Attribute
  AttributeNameAttr_1/AttributeName
/Attribute
Attribute
  AttributeNameAttr_2/AttributeName
/Attribute
Attribute
  AttributeNameAttr_3/AttributeName
/Attribute
  /REGISTRY_ENTRIES
/REGISTRY

I’m trying to get all Atribute nodes using the .. operator, but it always 
returns 0, even though xmlRoot looks fine.

protected function xmlService_resultHandler(event:ResultEvent):void
{
  if (event != null  event.result != null  event.result is XML) {
var xmlRoot:XML = event.result as XML;
if (xmlRoot  xmlRoot.length()  0) {
  var lst:XMLList = xmlRoot..Attribute;
  trace(lst length =  + lst.length());
}
  }
}


Michael





Re: [flexcoders] e4x help

2011-09-22 Thread Haykel BEN JEMIA
because the elements are then defined in the namespace 
http://schemas.dell.com/wbem/biosattributeregistry/1;. To access them
through e4x you have to create a corresponding namespace object, e.g.:

private namespace biosattributeregistry = 
http://schemas.dell.com/wbem/biosattributeregistry/1;;
use namespace biosattributeregistry;

Haykel Ben Jemia

Allmas
Web  RIA Development
http://www.allmas-tn.com




On Thu, Sep 22, 2011 at 4:32 PM, michael_reg...@dell.com wrote:

 **


 I guess I should have copied the entire XML.

 ** **

 REGISTRY xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://schemas.dell.com/wbem/biosattributeregistry/1file:///C:/work/12G/Attribute%20Registry/DCIM_AttributeRegistry.xsd;
 *xmlns*=http://schemas.dell.com/wbem/biosattributeregistry/1;

 ** **

 Turns out if I just remove the last namespace, *xmlns*=
 http://schemas.dell.com/wbem/biosattributeregistry/1

 ** **

 Then it works correctly.

 ** **

 Any idea why this would cause it to not be able to find the children?

 ** **

 *Michael J. Regert*

 ** **

 Please consider the environment before printing this email.

 ** **

 Confidentiality Notice | This e-mail message, including any attachments, is
 for the sole use of the intended recipient(s) and may contain confidential
 or proprietary information. Any unauthorized review, use, disclosure or
 distribution is prohibited. If you are not the intended recipient,
 immediately contact the sender by reply e-mail and destroy all copies of the
 original message.

 ** **

 ** **

 *From:* flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] *On
 Behalf Of *Brendan Meutzner
 *Sent:* Thursday, September 22, 2011 10:20 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] e4x help

 ** **

   

 You shouldn't do a check on the length() for xmlRoot... that represents the
 REGISTRY level... otherwise your code looks fine.

 ** **

 ** **

 On Thu, Sep 22, 2011 at 4:54 PM, michael_reg...@dell.com wrote:

   

 I must be missing something simple here.  I’m reading in XML that looks
 like this:

  

 ?*xml* version=1.0 encoding=UTF-8?

 REGISTRY

   REGISTRY_DECLARATION/

   REGISTRY_ENTRIES

 Attribute

   AttributeNameAttr_1/AttributeName

 /Attribute

 Attribute

   AttributeNameAttr_2/AttributeName

 /Attribute

 Attribute

   AttributeNameAttr_3/AttributeName

 /Attribute

   /REGISTRY_ENTRIES

 /REGISTRY

  

 I’m trying to get all Atribute nodes using the .. operator, but it always
 returns 0, even though xmlRoot looks fine.  

  

 *protected* *function* xmlService_resultHandler(event:ResultEvent):*void**
 ***

 {

   *if* (event != *null*  event.result != *null*  event.result 
 *is*XML) {
 

 *var* xmlRoot:XML = event.result *as* XML;

 *if* (xmlRoot  xmlRoot.length()  0) {

   *var* lst:XMLList = xmlRoot..Attribute;

   *trace*(*lst length = * + lst.length());

 }

   }

 }

  

  

 *Michael*

  

 ** **

 

  



RE: [flexcoders] e4x help

2011-09-22 Thread michael_regert
Ahhh.  YES!  That fixed it.  Thanks!

Michael J. Regert

Please consider the environment before printing this email.

Confidentiality Notice | This e-mail message, including any attachments, is for 
the sole use of the intended recipient(s) and may contain confidential or 
proprietary information. Any unauthorized review, use, disclosure or 
distribution is prohibited. If you are not the intended recipient, immediately 
contact the sender by reply e-mail and destroy all copies of the original 
message.


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf 
Of Haykel BEN JEMIA
Sent: Thursday, September 22, 2011 10:48 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] e4x help


because the elements are then defined in the namespace 
http://schemas.dell.com/wbem/biosattributeregistry/1;. To access them through 
e4x you have to create a corresponding namespace object, e.g.:

private namespace biosattributeregistry = 
http://schemas.dell.com/wbem/biosattributeregistry/1;;
use namespace biosattributeregistry;

Haykel Ben Jemia

Allmas
Web  RIA Development
http://www.allmas-tn.com



On Thu, Sep 22, 2011 at 4:32 PM, 
michael_reg...@dell.commailto:michael_reg...@dell.com wrote:

I guess I should have copied the entire XML.

REGISTRY xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
xsi:schemaLocation=http://schemas.dell.com/wbem/biosattributeregistry/1 
file:///C:/work/12G/Attribute%20Registry/DCIM_AttributeRegistry.xsd 
xmlns=http://schemas.dell.com/wbem/biosattributeregistry/1;

Turns out if I just remove the last namespace, 
xmlns=http://schemas.dell.com/wbem/biosattributeregistry/1;

Then it works correctly.

Any idea why this would cause it to not be able to find the children?

Michael J. Regert

Please consider the environment before printing this email.

Confidentiality Notice | This e-mail message, including any attachments, is for 
the sole use of the intended recipient(s) and may contain confidential or 
proprietary information. Any unauthorized review, use, disclosure or 
distribution is prohibited. If you are not the intended recipient, immediately 
contact the sender by reply e-mail and destroy all copies of the original 
message.


From: flexcoders@yahoogroups.commailto:flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.commailto:flexcoders@yahoogroups.com] On 
Behalf Of Brendan Meutzner
Sent: Thursday, September 22, 2011 10:20 AM
To: flexcoders@yahoogroups.commailto:flexcoders@yahoogroups.com
Subject: Re: [flexcoders] e4x help



You shouldn't do a check on the length() for xmlRoot... that represents the 
REGISTRY level... otherwise your code looks fine.


On Thu, Sep 22, 2011 at 4:54 PM, 
michael_reg...@dell.commailto:michael_reg...@dell.com wrote:

I must be missing something simple here.  I’m reading in XML that looks like 
this:

?xml version=1.0 encoding=UTF-8?
REGISTRY
  REGISTRY_DECLARATION/
  REGISTRY_ENTRIES
Attribute
  AttributeNameAttr_1/AttributeName
/Attribute
Attribute
  AttributeNameAttr_2/AttributeName
/Attribute
Attribute
  AttributeNameAttr_3/AttributeName
/Attribute
  /REGISTRY_ENTRIES
/REGISTRY

I’m trying to get all Atribute nodes using the .. operator, but it always 
returns 0, even though xmlRoot looks fine.

protected function xmlService_resultHandler(event:ResultEvent):void
{
  if (event != null  event.result != null  event.result is XML) {
var xmlRoot:XML = event.result as XML;
if (xmlRoot  xmlRoot.length()  0) {
  var lst:XMLList = xmlRoot..Attribute;
  trace(lst length =  + lst.length());
}
  }
}


Michael






[flexcoders] help with anonymous functions...

2011-09-22 Thread grimmwerks
OK I don't mean to make this a bit convoluted - but I guess the basics of the 
question is regarding using anonymous functions within a member class and being 
able to set variables within that member class.

The convoluted question is this:  I've got in my app an Interface class that 
has pointers to scala/java functions and are passed in callbacks like so:



function echoOrderEvent(callback:Function):void ;   

[UriParams(p1=correlationId)]
function echoOrderCacheEvent(callback:Function,extension:Object):void ;

 

Now in my class I create vars as functions for callbacks like so:

private var echoOrderCacheEvent:Function = function(jstr:String):void{
Alert.show(GOT ORDER EVENT );
}  

I set up the call back to this function as such:

interfaceClass.echoOrderCacheEvent(echoOrderCacheEvent, {correlationId: 
sessionId});   

 
Now, this works great except in the anonymous function I don't have any access 
to the public or private member vars of the class - only of course if I make 
the vars static, which is not what I want to do.

What I *can't* figure out is how to make the callback a regular member function 
such as:

public function echoEvent(str:String):void{
blah blah
}

And have that work with the interface class -- as 
interfaceClass.echoOrderCacheEvent(echoEvent, {correlationId: sessionId}) won't 
work; what I was thinking was perhaps .call or .apply methods but not sure how 
best to use them here...



Garry Schafer
grimmwerks
gr...@grimmwerks.com
portfolio: www.grimmwerks.com/







Re: [flexcoders] Trying to pass a value to the mxml/swf file from java(android).How?

2011-09-22 Thread ganaraj p r
In order to pass values to a swf you have a concept called as flashVars.

If you come from a java / C background you would know that your main entry
point in there is the main() function. This main function can be called
without any arguments or with arguments..( if you are familiar with argc and
argv[] ). FlashVars is something similiar to that concept.

Just have a read about those and you should be able to get the proper
answers.

On Wed, Sep 21, 2011 at 8:20 PM, rawat rawatsaur...@yahoo.co.in wrote:

 **


 HI,
 I have been trying to pass the values to the mxml file(whose output is .swf
 file) via android (java code) , But i am unable to do this.Here is my
 problem, I think tht .SWF file is a binary file(like exe , .out or .dll or
 .iso) which runs on flash platforms(browser, mobile phone supporting
 flash).Now i want the output of the .swf to be dependent on some values
 which I want to pass thourgh the android code.

 Other way is that I put the mxml files itself inside the eclipse(android
 project IDE) and pass the values to it (don't know how) compile it using
 mxmlc.exe compiler and link(don't know how ) with the android project and
 generate the final output file(we call it apk) and run it.Please suggest me
 which way to go even though my study is still partial but I am at the cross
 roads of confusion.Please suggest me which way to go and how.
 Rgds,
 Saurabh

  




-- 
Regards,
Ganaraj P R


Re: [flexcoders] help with anonymous functions...

2011-09-22 Thread Alex Harui
I don’t know why passing in echoEvent wouldn’t work.  What error did you get?

Another options are to pass in a third parameter as the object for use in call 
or apply.

You can theoretically do this as well in the constructor of the class:
Public function MyClassConstructor()
{
var thisObject:Object = this;
echoOrderCacheEvent = function(jstr:String):void{
trace(thisObject);  // use ‘thisObject’ instead of ‘this’
}
}


On 9/22/11 9:50 AM, grimmwerks gr...@grimmwerks.com wrote:






OK I don't mean to make this a bit convoluted - but I guess the basics of the 
question is regarding using anonymous functions within a member class and being 
able to set variables within that member class.

The convoluted question is this:  I've got in my app an Interface class that 
has pointers to scala/java functions and are passed in callbacks like so:



function echoOrderEvent(callback:Function):void ;

[UriParams(p1=correlationId)]
function echoOrderCacheEvent(callback:Function,extension:Object):void ;
n! bsp;

Now in my class I create vars as functions for callbacks like so:

private var echoOrderCacheEvent:Function = function(jstr:String):void{
Alert.show(GOT ORDER EVENT );
}

I set up the call back to this function as such:

interfaceClass.echoOrderCacheEvent(echoOrderCacheEvent, {correlationId: 
sessionId});
  ! 
 ! ;
Now, this works great except in the anonymous function I don't have any access 
to the public or private member vars of the class - only of course if I make 
the vars static, which is not what I want to do.

What I *can't* figure out is how to make the callback a regular member function 
such as:

public function echoEvent(str:String):void{
blah blah
}

And have that work with the interface class -- as 
interfaceClass.echoOrderCacheEvent(echoEvent, {correlationId: sessionId}) won't 
work; what I was thinking was perhaps .call or .apply methods but not sure how 
best to use them here...



Garry Schafer
grimmwerks
gr...@grimmwerks.com
portfolio: www.grimmwerks.com/ http://www.grimmwerks.com/










--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui


Re: [flexcoders] help with anonymous functions...

2011-09-22 Thread grimmwerks
Not getting an error, just getting ignored and the function is never called.


var scope:Object = this;
private var echoOrderCacheEvent:Function = 
function(jstr:String):void{
Alert.show(this);
trace(scope);

}

I've tried the old pass through - but it's definitely not working properly; the 
'this' that's getting called within the function is NOT the function  - it's a 
SubscriptionListener in the stomp framework as that's what's calling the 
callback through the interface; something another dev has created and just want 
to come back with enough ammunition that the callbacks aren't being set 
properly:

It seems to me that he's creating another anonymous function as part of the 
stomp dispatching and then everything is getting lost:

ReferenceError: Error #1069: Property com.investlab.mix.common.model::scope not 
found on interbahn.SubscriptionListener and there is no default value.
at 
Function/anonymous()[/Users/grimm/Documents/__WORK/__INVESTLAB/MIX/src/com/investlab/mix/common/model/OrderProxyNew.as:142]
at 
interbahn::SubscriptionListener/apply()[C:\transfer\IdeaProjects\as3-interbahn\main\as3\src\interbahn\SubscriptionListener.as:59]
at 
Function/anonymous()[C:\transfer\IdeaProjects\as3-interbahn\main\as3\src\interbahn\stomp\StompConnection.as:35]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at 
org.codehaus.stomp::Stomp/dispatchFrame()[/Users/grimm/Documents/__WORK/__INVESTLAB/MIX/src/org/codehaus/stomp/Stomp.as:350]
at 
org.codehaus.stomp::Stomp/processFrame()[/Users/grimm/Documents/__WORK/__INVESTLAB/MIX/src/org/codehaus/stomp/Stomp.as:326]
at 
org.codehaus.stomp::Stomp/onData()[/Users/grimm/Documents/__WORK/__INVESTLAB/MIX/src/org/codehaus/stomp/Stomp.as:312]



On Sep 22, 2011, at 1:32 PM, Alex Harui wrote:

 
 
 I don’t know why passing in echoEvent wouldn’t work.  What error did you get?
 
 Another options are to pass in a third parameter as the object for use in 
 call or apply.
 
 You can theoretically do this as well in the constructor of the class:
 Public function MyClassConstructor()
 {
 var thisObject:Object = this;
 echoOrderCacheEvent = function(jstr:String):void{
 trace(thisObject);  // use ‘thisObject’ instead of ‘this’
 }
 }
 
 
 On 9/22/11 9:50 AM, grimmwerks gr...@grimmwerks.com wrote:
 
 
  
  

 
 OK I don't mean to make this a bit convoluted - but I guess the basics of 
 the question is regarding using anonymous functions within a member class 
 and being able to set variables within that member class.
 
 The convoluted question is this:  I've got in my app an Interface class that 
 has pointers to scala/java functions and are passed in callbacks like so:
 
 
 
 function echoOrderEvent(callback:Function):void ; 
 
 [UriParams(p1=correlationId)]
 function echoOrderCacheEvent(callback:Function,extension:Object):void ;
 n! bsp; 
   
 
 Now in my class I create vars as functions for callbacks like so:
 
 private var echoOrderCacheEvent:Function = function(jstr:String):void{
 Alert.show(GOT ORDER EVENT );
 }  
 
 I set up the call back to this function as such:
 
 interfaceClass.echoOrderCacheEvent(echoOrderCacheEvent, {correlationId: 
 sessionId});  
   !  
 ! ; 
 Now, this works great except in the anonymous function I don't have any 
 access to the public or private member vars of the class - only of course if 
 I make the vars static, which is not what I want to do.
 
 What I *can't* figure out is how to make the callback a regular member 
 function such as:
 
 public function echoEvent(str:String):void{
 blah blah
 }
 
 And have that work with the interface class -- as 
 interfaceClass.echoOrderCacheEvent(echoEvent, {correlationId: sessionId}) 
 won't work; what I was thinking was perhaps .call or .apply methods but not 
 sure how best to use them here...
 
 
 
 Garry Schafer
 grimmwerks
 gr...@grimmwerks.com
 portfolio: www.grimmwerks.com/ http://www.grimmwerks.com/ 
 
 
 
 
 
  

 
 
 
 -- 
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui
 
 
 

Garry Schafer
grimmwerks
gr...@grimmwerks.com
portfolio: www.grimmwerks.com/







Re: [flexcoders] help with anonymous functions...

2011-09-22 Thread Alex Harui
IMHO anonymous  functions are way more trouble than they are worth.  If I had 
the time, I would eliminate them from all framework code.

Looks from the stacktrace that someone is using apply() to change the this 
pointer.


On 9/22/11 10:46 AM, grimmwerks gr...@grimmwerks.com wrote:






Not getting an error, just getting ignored and the function is never called.


var scope:Object = this;
private var echoOrderCacheEvent:Function = function(jstr:String):void{
Alert.show(this);
trace(scope);

}

I've tried the old pass through - but it's definitely not working properly; the 
'this' that's getting called within the function is NOT the function  - it's a 
SubscriptionListener in the stomp framework as that's what's calling the 
callback through the interface; something another dev has created and just want 
to come back with enough ammunition that the callbacks aren't being set 
properly:

It seems to me that he's creating another anonymous function as part of the 
stomp dispatching and then everything is getting lost:

ReferenceError: Error #1069: Property com.investlab.mix.common.model::scope not 
found on interbahn.SubscriptionListener and there is no default value.
at 
Function/anonymous()[/Users/grimm/Documents/__WORK/__INVESTLAB/MIX/src/com/investlab/mix/common/model/OrderProxyNew.as:142]
at 
interbahn::SubscriptionListener/apply()[C:\transfer\IdeaProjects\as3-interbahn\main\as3\src\interbahn\SubscriptionListener.as:59]
at 
Function/anonymous()[C:\transfer\IdeaProjects\as3-interbahn\main\as3\src\interbahn\stomp\StompConnection.as:35]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at 
org.codehaus.stomp::Stomp/dispatchFrame()[/Users/grimm/Documents/__WORK/__INVESTLAB/MIX/src/org/codehaus/stomp/Stomp.as:350]
at 
org.codehaus.stomp::Stomp/processFrame()[/Users/grimm/Documents/__WORK/__INVESTLAB/MIX/src/org/codehaus/stomp/Stomp.as:326]
at 
org.codehaus.stomp::Stomp/onData()[/Users/grimm/Documents/__WORK/__INVESTLAB/MIX/src/org/codehaus/stomp/Stomp.as:312]



On Sep 22, 2011, at 1:32 PM, Alex Harui wrote:



I don’t know why passing in echoEvent wouldn’t work.  What error did you get?

Another options are to pass in a third parameter as the object for use in call 
or apply.

You can theoretically do this as well in the constructor of the class:
Public function MyClassConstructor()
{
var thisObject:Object = this;
echoOrderCacheEvent = function(jstr:String):void{
trace(thisObject);  // use ‘thisObject’ instead of ‘this’
}
}


On 9/22/11 9:50 AM, grimmwerks gr...@grimmwerks.com wrote:






OK I don't mean to make this a bit convoluted - but I guess the basics of the 
question is regarding using anonymous functions within a member class and being 
able to set variables within that member class.

The convoluted question is this:  I've got in my app an Interface class that 
has pointers to scala/java functions and are passed in callbacks like so:



function echoOrderEvent(callback:Function):void ;

[UriParams(p1=correlationId)]
function echoOrderCacheEvent(callback:Function,extension:Object):void ;
   n! bsp;

Now in my class I create vars as functions for callbacks like so:

private var echoOrderCacheEvent:Function = function(jstr:String):void{
Alert.show(GOT ORDER EVENT );
}

I set up the call back to this function as such:

interfaceClass.echoOrderCacheEvent(echoOrderCacheEvent, {correlationId: 
sessionId});
  ! 
 ! ;
Now, this works great except in the anonymous function I don't have any access 
to the public or private member vars of the class - only of course if I make 
the vars static, which is not what I want to do.

What I *can't* figure out is how to make the callback a regular member function 
such as:

public function echoEvent(str:String):void{
blah blah
}

And have that work with the interface class -- as 
interfaceClass.echoOrderCacheEvent(echoEvent, {correlationId: sessionId}) won't 
work; what I was thinking was perhaps .call or .apply methods but not sure how 
best to use them here...



Garry Schafer
grimmwerks
gr...@grimmwerks.com
portfolio: www.grimmwerks.com/ http://www.grimmwerks.com/  
http://www.grimmwerks.com/










--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui


Re: [flexcoders] help with anonymous functions...

2011-09-22 Thread grimmwerks
Thanks  -- yeah it seems like the something's happening on the stomp / callback 
before it's getting to me.

Have another quickie about itemrenderers and factory properties, but going to 
ask on another thread.

On Sep 22, 2011, at 2:11 PM, Alex Harui wrote:

 
 
 IMHO anonymous  functions are way more trouble than they are worth.  If I had 
 the time, I would eliminate them from all framework code.
 
 Looks from the stacktrace that someone is using apply() to change the this 
 pointer.
 
 
 On 9/22/11 10:46 AM, grimmwerks gr...@grimmwerks.com wrote:
 
 
  
  

 
 Not getting an error, just getting ignored and the function is never called.
 
 
 var scope:Object = this;
 private var echoOrderCacheEvent:Function = function(jstr:String):void{
 Alert.show(this);
 trace(scope);
 
 }
 
 I've tried the old pass through - but it's definitely not working properly; 
 the 'this' that's getting called within the function is NOT the function  - 
 it's a SubscriptionListener in the stomp framework as that's what's calling 
 the callback through the interface; something another dev has created and 
 just want to come back with enough ammunition that the callbacks aren't 
 being set properly:
 
 It seems to me that he's creating another anonymous function as part of the 
 stomp dispatching and then everything is getting lost:
 
 ReferenceError: Error #1069: Property com.investlab.mix.common.model::scope 
 not found on interbahn.SubscriptionListener and there is no default value.
 at 
 Function/anonymous()[/Users/grimm/Documents/__WORK/__INVESTLAB/MIX/src/com/investlab/mix/common/model/OrderProxyNew.as:142]
 at 
 interbahn::SubscriptionListener/apply()[C:\transfer\IdeaProjects\as3-interbahn\main\as3\src\interbahn\SubscriptionListener.as:59]
 at 
 Function/anonymous()[C:\transfer\IdeaProjects\as3-interbahn\main\as3\src\interbahn\stomp\StompConnection.as:35]
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at 
 org.codehaus.stomp::Stomp/dispatchFrame()[/Users/grimm/Documents/__WORK/__INVESTLAB/MIX/src/org/codehaus/stomp/Stomp.as:350]
 at 
 org.codehaus.stomp::Stomp/processFrame()[/Users/grimm/Documents/__WORK/__INVESTLAB/MIX/src/org/codehaus/stomp/Stomp.as:326]
 at 
 org.codehaus.stomp::Stomp/onData()[/Users/grimm/Documents/__WORK/__INVESTLAB/MIX/src/org/codehaus/stomp/Stomp.as:312]
 
 
 
 On Sep 22, 2011, at 1:32 PM, Alex Harui wrote:
 
 
 
 I don’t know why passing in echoEvent wouldn’t work.  What error did you 
 get?
 
 Another options are to pass in a third parameter as the object for use in 
 call or apply.
 
 You can theoretically do this as well in the constructor of the class:
 Public function MyClassConstructor()
 {
 var thisObject:Object = this;
 echoOrderCacheEvent = function(jstr:String):void{
 trace(thisObject);  // use ‘thisObject’ instead of ‘this’
 }
 }
 
 
 On 9/22/11 9:50 AM, grimmwerks gr...@grimmwerks.com wrote:
 
 
  
  

 
 OK I don't mean to make this a bit convoluted - but I guess the basics of 
 the question is regarding using anonymous functions within a member class 
 and being able to set variables within that member class.
 
 The convoluted question is this:  I've got in my app an Interface class 
 that has pointers to scala/java functions and are passed in callbacks like 
 so:
 
 
 
 function echoOrderEvent(callback:Function):void ; 
 
 [UriParams(p1=correlationId)]
 function echoOrderCacheEvent(callback:Function,extension:Object):void ;
n! bsp;

 
 Now in my class I create vars as functions for callbacks like so:
 
 private var echoOrderCacheEvent:Function = function(jstr:String):void{
 Alert.show(GOT ORDER EVENT );
 }  
 
 I set up the call back to this function as such:
 
 interfaceClass.echoOrderCacheEvent(echoOrderCacheEvent, {correlationId: 
 sessionId});  
   !
   ! ; 
 Now, this works great except in the anonymous function I don't have any 
 access to the public or private member vars of the class - only of course 
 if I make the vars static, which is not what I want to do.
 
 What I *can't* figure out is how to make the callback a regular member 
 function such as:
 
 public function echoEvent(str:String):void{
 blah blah
 }
 
 And have that work with the interface class -- 
 asinterfaceClass.echoOrderCacheEvent(echoEvent, {correlationId: 
 sessionId}) won't work; what I was thinking was perhaps .call or .apply 
 methods but not sure how best to use them here...
 
 
 
 Garry Schafer
 grimmwerks
 gr...@grimmwerks.com
 portfolio: www.grimmwerks.com/ http://www.grimmwerks.com/  
 http://www.grimmwerks.com/ 
 
 
 
 
 
  

 
 
 
 -- 
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui
 
 
 

Garry Schafer
grimmwerks
gr...@grimmwerks.com
portfolio: 

[flexcoders] Is it possible to add Flex components to the Stage?

2011-09-22 Thread Hogs Haven
From everything I've read, Flex components can only be added to Flex 
Components (ie: VBox to Application, VGroup to Panel, etc)

I'm working in an AS3 view library (no Flex, just Sprites) where I need to add 
a Scrollable container component to the Stage on a click event. There's no way 
to do this as I see it unless I write my own Scroll container, use Flex SDK 
(don't think this works), or use fl.containers.ScrollPane (which is not an 
option since we're not using a .fla)

So basically, I'm trying to accomplish this, as simple runnable example, but it 
fails silently and nothing appears...any ideas? Thanks.


?xml version=1.0 encoding=utf-8?
s:Application xmlns:fx=http://ns.adobe.com/mxml/2009; 
   xmlns:s=library://ns.adobe.com/flex/spark 
   xmlns:mx=library://ns.adobe.com/flex/mx
creationComplete=application1_creationCompleteHandler(event)
fx:Script
![CDATA[
import mx.containers.Panel;
import mx.core.UIComponent;
import mx.events.FlexEvent;


protected function application1_creationCompleteHandler(event:FlexEvent):void
{
  addEventListener(Event.ADDED_TO_STAGE, onAdded);
}

private function onAdded(e:Event):void 
{
var myPanel : Panel = new Panel();
myPanel.width=100;
myPanel.height=100;
stage.addChild(myPanel); //nothing happens
}
]]
/fx:Script
fx:Declarations/fx:Declarations

/s:Application




[flexcoders] ClassFactory, properties, itemrenderers and changing prop dynamically

2011-09-22 Thread grimmwerks
Here's another convoluted question -- I've got a list that is bound to an array 
of a certain Class - let's cal them Permissions.  In the Permissions class 
you've got userId, read and write (booleans there, id for userId, normal stuff).

I'm using the same itemrenderer in two lists - a source list which is not 
editable and a drop list which is;  the itemrenderer has an 'editable' variable 
and I'm setting each list's ClassFactory to this same itemrenderer, with one 
ClassFactory's properties setting editable to false, one to true.  All that is 
good.

Now the strange request I JUST had from someone here is that once an item is 
dragged and dropped from the source list to the drop list, the item in the 
source list should dim to show that it's already been chosen, unable to choose 
again.   I've created a property called itemEnabled in the itemrenderer, 
defaulting to true (so it's ignored in the droplist basically).

Here's the thing; it would be simple enough to set a particular item's 
'itemenabled' property in the dataproviider and it would trickle down; but 
since this is a list of cast objects that don't have the itemEnabled property 
it's a no go...

So is there a way of selecting an itemrenderer or item at a certain position in 
the sourcelist and setting IT's itemEnabled to false? Is it something with the 
classfactory for a specific item?


Garry Schafer
grimmwerks
gr...@grimmwerks.com
portfolio: www.grimmwerks.com/







[flexcoders] Re: Is it possible to add Flex components to the Stage?

2011-09-22 Thread Hogs Haven
Thanks, but flash.display.Stage is not a Flex component; therefore it only has 
addChild(). addElement() is part of the spark Flex classes.

--- In flexcoders@yahoogroups.com, grimmwerks grimm@... wrote:

 Try stage.addElement  rather than addChild?
 
 
 On Sep 22, 2011, at 2:30 PM, Hogs Haven wrote:
 
  From everything I've read, Flex components can only be added to Flex 
  Components (ie: VBox to Application, VGroup to Panel, etc)
  
  I'm working in an AS3 view library (no Flex, just Sprites) where I need to 
  add a Scrollable container component to the Stage on a click event. There's 
  no way to do this as I see it unless I write my own Scroll container, use 
  Flex SDK (don't think this works), or use fl.containers.ScrollPane (which 
  is not an option since we're not using a .fla)
  
  So basically, I'm trying to accomplish this, as simple runnable example, 
  but it fails silently and nothing appears...any ideas? Thanks.
  
  
  ?xml version=1.0 encoding=utf-8?
  s:Application xmlns:fx=http://ns.adobe.com/mxml/2009; 
 xmlns:s=library://ns.adobe.com/flex/spark 
 xmlns:mx=library://ns.adobe.com/flex/mx
  creationComplete=application1_creationCompleteHandler(event)
  fx:Script
  ![CDATA[
  import mx.containers.Panel;
  import mx.core.UIComponent;
  import mx.events.FlexEvent;
  
  
  protected function 
  application1_creationCompleteHandler(event:FlexEvent):void
  {
   addEventListener(Event.ADDED_TO_STAGE, onAdded);
  }
  
  private function onAdded(e:Event):void 
  {
 var myPanel : Panel = new Panel();
 myPanel.width=100;
 myPanel.height=100;
 stage.addChild(myPanel); //nothing happens
  }
  ]]
  /fx:Script
  fx:Declarations/fx:Declarations
  
  /s:Application
  
  
  
  
  
  
  --
  Flexcoders Mailing List
  FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Alternative FAQ location: 
  https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
  Search Archives: 
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
  
  
  
 
 Garry Schafer
 grimmwerks
 grimm@...
 portfolio: www.grimmwerks.com/





Re: [flexcoders] Is it possible to add Flex components to the Stage?

2011-09-22 Thread grimmwerks
Try stage.addElement  rather than addChild?


On Sep 22, 2011, at 2:30 PM, Hogs Haven wrote:

 From everything I've read, Flex components can only be added to Flex 
 Components (ie: VBox to Application, VGroup to Panel, etc)
 
 I'm working in an AS3 view library (no Flex, just Sprites) where I need to 
 add a Scrollable container component to the Stage on a click event. There's 
 no way to do this as I see it unless I write my own Scroll container, use 
 Flex SDK (don't think this works), or use fl.containers.ScrollPane (which is 
 not an option since we're not using a .fla)
 
 So basically, I'm trying to accomplish this, as simple runnable example, but 
 it fails silently and nothing appears...any ideas? Thanks.
 
 
 ?xml version=1.0 encoding=utf-8?
 s:Application xmlns:fx=http://ns.adobe.com/mxml/2009; 
  xmlns:s=library://ns.adobe.com/flex/spark 
  xmlns:mx=library://ns.adobe.com/flex/mx
 creationComplete=application1_creationCompleteHandler(event)
   fx:Script
   ![CDATA[
   import mx.containers.Panel;
   import mx.core.UIComponent;
   import mx.events.FlexEvent;
   
   
 protected function application1_creationCompleteHandler(event:FlexEvent):void
 {
  addEventListener(Event.ADDED_TO_STAGE, onAdded);
 }
   
 private function onAdded(e:Event):void 
 {
var myPanel : Panel = new Panel();
myPanel.width=100;
myPanel.height=100;
stage.addChild(myPanel); //nothing happens
 }
   ]]
   /fx:Script
   fx:Declarations/fx:Declarations
   
 /s:Application
 
 
 
 
 
 
 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location: 
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives: 
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
 
 
 

Garry Schafer
grimmwerks
gr...@grimmwerks.com
portfolio: www.grimmwerks.com/







[flexcoders] Re: ClassFactory, properties, itemrenderers and changing prop dynamically

2011-09-22 Thread valdhor
I don't know about others here but IMHO a better user experience would be to 
remove the selected item from the source list. This way it is not even there to 
be selected. Just a simple matter of removing it from the dataprovider.

--- In flexcoders@yahoogroups.com, grimmwerks grimm@... wrote:

 Here's another convoluted question -- I've got a list that is bound to an 
 array of a certain Class - let's cal them Permissions.  In the Permissions 
 class you've got userId, read and write (booleans there, id for userId, 
 normal stuff).
 
 I'm using the same itemrenderer in two lists - a source list which is not 
 editable and a drop list which is;  the itemrenderer has an 'editable' 
 variable and I'm setting each list's ClassFactory to this same itemrenderer, 
 with one ClassFactory's properties setting editable to false, one to true.  
 All that is good.
 
 Now the strange request I JUST had from someone here is that once an item is 
 dragged and dropped from the source list to the drop list, the item in the 
 source list should dim to show that it's already been chosen, unable to 
 choose again.   I've created a property called itemEnabled in the 
 itemrenderer, defaulting to true (so it's ignored in the droplist basically).
 
 Here's the thing; it would be simple enough to set a particular item's 
 'itemenabled' property in the dataproviider and it would trickle down; but 
 since this is a list of cast objects that don't have the itemEnabled property 
 it's a no go...
 
 So is there a way of selecting an itemrenderer or item at a certain position 
 in the sourcelist and setting IT's itemEnabled to false? Is it something with 
 the classfactory for a specific item?
 
 
 Garry Schafer
 grimmwerks
 grimm@...
 portfolio: www.grimmwerks.com/





Re: [flexcoders] Re: Is it possible to add Flex components to the Stage?

2011-09-22 Thread Alex Harui
Flex components cannot be added to the Stage.   You can add them to 
SystemManager and get pretty much the same effect.


On 9/22/11 11:56 AM, Hogs Haven e_ba...@yahoo.com wrote:






Thanks, but flash.display.Stage is not a Flex component; therefore it only has 
addChild(). addElement() is part of the spark Flex classes.

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , 
grimmwerks grimm@... wrote:

 Try stage.addElement  rather than addChild?


 On Sep 22, 2011, at 2:30 PM, Hogs Haven wrote:

  From everything I've read, Flex components can only be added to Flex 
  Components (ie: VBox to Application, VGroup to Panel, etc)
 
  I'm working in an AS3 view library (no Flex, just Sprites) where I need to 
  add a Scrollable container component to the Stage on a click event. There's 
  no way to do this as I see it unless I write my own Scroll container, use 
  Flex SDK (don't think this works), or use fl.containers.ScrollPane (which 
  is not an option since we're not using a .fla)
 
  So basically, I'm trying to accomplish this, as simple runnable example, 
  but it fails silently and nothing appears...any ideas? Thanks.
 
 
  ?xml version=1.0 encoding=utf-8?
  s:Application xmlns:fx=http://ns.adobe.com/mxml/2009;
 xmlns:s=library://ns.adobe.com/flex/spark
 xmlns:mx=library://ns.adobe.com/flex/mx
  creationComplete=application1_creationCompleteHandler(event)
  fx:Script
  ![CDATA[
  import mx.containers.Panel;
  import mx.core.UIComponent;
  import mx.events.FlexEvent;
 
 
  protected function 
  application1_creationCompleteHandler(event:FlexEvent):void
  {
   addEventListener(Event.ADDED_TO_STAGE, onAdded);
  }
 
  private function onAdded(e:Event):void
  {
 var myPanel : Panel = new Panel();
 myPanel.width=100;
 myPanel.height=100;
 stage.addChild(myPanel); //nothing happens
  }
  ]]
  /fx:Script
  fx:Declarations/fx:Declarations
 
  /s:Application
 
 
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Alternative FAQ location: 
  https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
  Search Archives: 
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
 
 
 

 Garry Schafer
 grimmwerks
 grimm@...
 portfolio: www.grimmwerks.com/







--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui


Re: [flexcoders] ClassFactory, properties, itemrenderers and changing prop dynamically

2011-09-22 Thread Alex Harui
Because renderers get recycled, it is not recommended to access a renderer 
instance and change properties on it.  There is a indexToItemRenderer() method, 
but I wouldn’t use it for this.

The recommended practice is an “associated list”, essentially a weak-reference 
dictionary or object map that stores additional information associated with the 
data objects (not the renderers).  In this case, I would probably use a 
dictionary and stuff each dropped object in the dictionary.  Each renderer will 
compare its data property to see if it is in the dictionary and set the 
itemEnabled accordingly.


On 9/22/11 11:33 AM, grimmwerks gr...@grimmwerks.com wrote:






Here's another convoluted question -- I've got a list that is bound to an array 
of a certain Class - let's cal them Permissions.  In the Permissions class 
you've got userId, read and write (booleans there, id for userId, normal stuff).

I'm using the same itemrenderer in two lists - a source list which is not 
editable and a drop list which is;  the itemrenderer has an 'editable' variable 
and I'm setting each list's ClassFactory to this same itemrenderer, with one 
ClassFactory's properties setting editable to false, one to true.  All that is 
good.

Now the strange request I JUST had from someone here is that once an item is 
dragged and dropped from the source list to the drop list, the item in the 
source list should dim to show that it's already been chosen, unable to choose 
again.   I've created a property called itemEnabled in the itemrenderer,! 
defaulting to true (so it's ignored in the droplist basically).

Here's the thing; it would be simple enough to set a particular item's 
'itemenabled' property in the dataproviider and it would trickle down; but 
since this is a list of cast objects that don't have the itemEnabled property 
it's a no go...

So is there a way of selecting an itemrenderer or item at a certain position in 
the sourcelist and setting IT's itemEnabled to false? Is it something with the 
classfactory for a specific item?


Garry Schafer
grimmwerks
gr...@grimmwerks.com
portfolio: www.grimmwerks.com/ http://www.grimmwerks.com/










--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui


Re: [flexcoders] Re: ClassFactory, properties, itemrenderers and changing prop dynamically

2011-09-22 Thread grimmwerks
I hear you - but the thing is these are more CHOICES that one can make - like a 
menu of items.  If one can only get a hamburger it's not the only hamburger the 
store has...


On Sep 22, 2011, at 3:08 PM, valdhor wrote:

 I don't know about others here but IMHO a better user experience would be to 
 remove the selected item from the source list. This way it is not even there 
 to be selected. Just a simple matter of removing it from the dataprovider.

Garry Schafer
grimmwerks
gr...@grimmwerks.com
portfolio: www.grimmwerks.com/







Re: [flexcoders] ClassFactory, properties, itemrenderers and changing prop dynamically

2011-09-22 Thread grimmwerks
I see your point -- I'm already doing an object / hashmap of items; what would 
be the best way of having the itemrenderer's check said list though?  I'm 
actually working with PureMVC and all code is in the mediator, everything in 
the view - ie list and of course itemrenderers... so it's not even something 
that an itemrenderer would be privy to...  plus if I'm using the same 
itemrenderer for the source and the drop list I'd almost have to tell  
hmmm;  could I *pass* the list each itemrenderer watches through the factory 
properties.?



On Sep 22, 2011, at 3:18 PM, Alex Harui wrote:

 
 
 Because renderers get recycled, it is not recommended to access a renderer 
 instance and change properties on it.  There is a indexToItemRenderer() 
 method, but I wouldn’t use it for this.
 
 The recommended practice is an “associated list”, essentially a 
 weak-reference dictionary or object map that stores additional information 
 associated with the data objects (not the renderers).  In this case, I would 
 probably use a dictionary and stuff each dropped object in the dictionary.  
 Each renderer will compare its data property to see if it is in the 
 dictionary and set the itemEnabled accordingly.
 
 
 On 9/22/11 11:33 AM, grimmwerks gr...@grimmwerks.com wrote:
 
 
  
  

 
 Here's another convoluted question -- I've got a list that is bound to an 
 array of a certain Class - let's cal them Permissions.  In the Permissions 
 class you've got userId, read and write (booleans there, id for userId, 
 normal stuff).
 
 I'm using the same itemrenderer in two lists - a source list which is not 
 editable and a drop list which is;  the itemrenderer has an 'editable' 
 variable and I'm setting each list's ClassFactory to this same itemrenderer, 
 with one ClassFactory's properties setting editable to false, one to true.  
 All that is good.
 
 Now the strange request I JUST had from someone here is that once an item is 
 dragged and dropped from the source list to the drop list, the item in the 
 source list should dim to show that it's already been chosen, unable to 
 choose again.   I've created a property called itemEnabled in the 
 itemrenderer,! defaulting to true (so it's ignored in the droplist 
 basically).
 
 Here's the thing; it would be simple enough to set a particular item's 
 'itemenabled' property in the dataproviider and it would trickle down; but 
 since this is a list of cast objects that don't have the itemEnabled 
 property it's a no go...
 
 So is there a way of selecting an itemrenderer or item at a certain position 
 in the sourcelist and setting IT's itemEnabled to false? Is it something 
 with the classfactory for a specific item?
 
 
 Garry Schafer
 grimmwerks
 gr...@grimmwerks.com
 portfolio: www.grimmwerks.com/ http://www.grimmwerks.com/ 
 
 
 
 
 
  

 
 
 
 -- 
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui
 
 
 

Garry Schafer
grimmwerks
gr...@grimmwerks.com
portfolio: www.grimmwerks.com/







Re: [flexcoders] ClassFactory, properties, itemrenderers and changing prop dynamically

2011-09-22 Thread Alex Harui
If it were me, I would subclass the List and add an “associatedList” property 
that references this map.

The logic for setting itemEnabled in the renderer is hopefully in an override 
of commitProperties.  I would override the data setter to call 
invalidateProperties.

Then in commitProperties, you can do something like:

{code}
var list:MyList = owner as MyList;
if (list) // will be null in the destination list since it is just a List 
and not a MyList
{
var map:Object = list.associatedList;
{code}

On 9/22/11 12:39 PM, grimmwerks gr...@grimmwerks.com wrote:






I see your point -- I'm already doing an object / hashmap of items; what would 
be the best way of having the itemrenderer's check said list though?  I'm 
actually working with PureMVC and all code is in the mediator, everything in 
the view - ie list and of course itemrenderers... so it's not even something 
that an itemrenderer would be privy to...  plus if I'm using the same 
itemrenderer for the source and the drop list I'd almost have to tell  
hmmm;  could I *pass* the list each itemrenderer watches through the factory 
properties.?



On Sep 22, 2011, at 3:18 PM, Alex Harui wrote:



Because renderers get recycled, it is not recommended to access a renderer 
instance and change properties on it.  There is a indexToItemRenderer() method, 
but I wouldn’t use it for this.

The recommended practice is an “associated list”, essentially a weak-reference 
dictionary or object map that stores additional information associated with the 
data objects (not the renderers).  In this case, I would probably use a 
dictionary and stuff each dropped object in the dictionary.  Each renderer will 
compare its data property to see if it is in the dictionary and set the 
itemEnabled accordingly.


On 9/22/11 11:33 AM, grimmwerks gr...@grimmwerks.com wrote:






Here's another convoluted question -- I've got a list that is bound to an array 
of a certain Class - let's cal them Permissions.  In the Permissions class 
you've got userId, read and write (booleans there, id for userId, normal stuff).

I'm using the same itemrenderer in two lists - a source list which is not 
editable and a drop list which is;  the itemrenderer has an 'editable' variable 
and I'm setting each list's ClassFactory to this same itemrenderer, with one 
ClassFactory's properties setting editable to false, one to true.  All that is 
good.

Now the strange request I JUST had from someone here is that once an item is 
dragged and dropped from the source list to the drop list, the item in the 
source list should dim to show that it's already been chosen, unable to choose 
again.   I've created a property called itemEnabled in the itemrenderer,! 
defaulting to true (so it's ignored in the droplist basically).

Here's the thing; it would be simple enough to set a particular item's 
'itemenabled' property in the dataproviider and it would trickle down; but 
since this is a list of cast objects that don't have the itemEnabled property 
it's a no go...

So is there a way of selecting an itemrenderer or item at a certain position in 
the sourcelist and setting IT's itemEnabled to false? Is it something with the 
classfactory for a specific item?


Garry Schafer
grimmwerks
gr...@grimmwerks.com
portfolio: www.grimmwerks.com/ http://www.grimmwerks.com/  
http://www.grimmwerks.com/










--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui


[flexcoders] Re: Is it possible to add Flex components to the Stage?

2011-09-22 Thread Hogs Haven
Thanks Alex for the reply. Yea, with systemManager being a Flex component I 
guess I'm out of luck. OK, refactor time.

--- In flexcoders@yahoogroups.com, Alex Harui aharui@... wrote:

 Flex components cannot be added to the Stage.   You can add them to 
 SystemManager and get pretty much the same effect.
 
 
 On 9/22/11 11:56 AM, Hogs Haven e_baggg@... wrote:
 
 
 
 
 
 
 Thanks, but flash.display.Stage is not a Flex component; therefore it only 
 has addChild(). addElement() is part of the spark Flex classes.
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , 
 grimmwerks grimm@ wrote:
 
  Try stage.addElement  rather than addChild?
 
 
  On Sep 22, 2011, at 2:30 PM, Hogs Haven wrote:
 
   From everything I've read, Flex components can only be added to Flex 
   Components (ie: VBox to Application, VGroup to Panel, etc)
  
   I'm working in an AS3 view library (no Flex, just Sprites) where I need 
   to add a Scrollable container component to the Stage on a click event. 
   There's no way to do this as I see it unless I write my own Scroll 
   container, use Flex SDK (don't think this works), or use 
   fl.containers.ScrollPane (which is not an option since we're not using a 
   .fla)
  
   So basically, I'm trying to accomplish this, as simple runnable example, 
   but it fails silently and nothing appears...any ideas? Thanks.
  
  
   ?xml version=1.0 encoding=utf-8?
   s:Application xmlns:fx=http://ns.adobe.com/mxml/2009;
  xmlns:s=library://ns.adobe.com/flex/spark
  xmlns:mx=library://ns.adobe.com/flex/mx
   creationComplete=application1_creationCompleteHandler(event)
   fx:Script
   ![CDATA[
   import mx.containers.Panel;
   import mx.core.UIComponent;
   import mx.events.FlexEvent;
  
  
   protected function 
   application1_creationCompleteHandler(event:FlexEvent):void
   {
addEventListener(Event.ADDED_TO_STAGE, onAdded);
   }
  
   private function onAdded(e:Event):void
   {
  var myPanel : Panel = new Panel();
  myPanel.width=100;
  myPanel.height=100;
  stage.addChild(myPanel); //nothing happens
   }
   ]]
   /fx:Script
   fx:Declarations/fx:Declarations
  
   /s:Application
  
  
  
  
   
  
   --
   Flexcoders Mailing List
   FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
   Alternative FAQ location: 
   https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
   Search Archives: 
   http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups 
   Links
  
  
  
 
  Garry Schafer
  grimmwerks
  grimm@
  portfolio: www.grimmwerks.com/
 
 
 
 
 
 
 
 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui





Re: [flexcoders] Is it possible to add Flex components to the Stage?

2011-09-22 Thread Jeffry Houser


 addElement is only defined in spark components; that will just throw a 
compile time error.


 I'm not sure why you want to add a Flex Component directly to the 
stage.  I suppose in theory you could; but that would bypass all the 
Flex Framework code to position and size the component.  You'd, in 
essence, need to write your own layout manager. that performs the same 
functionality as the Flex Layout manager.


 In the context of Flex; it probably isn't a good idea to access the 
stage directly.


On 9/22/2011 2:33 PM, grimmwerks wrote:


Try stage.addElement  rather than addChild?



On Sep 22, 2011, at 2:30 PM, Hogs Haven wrote:

From everything I've read, Flex components can only be added to Flex 
Components (ie: VBox to Application, VGroup to Panel, etc)


I'm working in an AS3 view library (no Flex, just Sprites) where I 
need to add a Scrollable container component to the Stage on a click 
event. There's no way to do this as I see it unless I write my own 
Scroll container, use Flex SDK (don't think this works), or use 
fl.containers.ScrollPane (which is not an option since we're not 
using a .fla)


So basically, I'm trying to accomplish this, as simple runnable 
example, but it fails silently and nothing appears...any ideas? Thanks.



?xml version=1.0 encoding=utf-8?
s:Application xmlns:fx=http://ns.adobe.com/mxml/2009;
  xmlns:s=library://ns.adobe.com/flex/spark
  xmlns:mx=library://ns.adobe.com/flex/mx
creationComplete=application1_creationCompleteHandler(event)
fx:Script
![CDATA[
import mx.containers.Panel;
import mx.core.UIComponent;
import mx.events.FlexEvent;


protected function 
application1_creationCompleteHandler(event:FlexEvent):void

{
 addEventListener(Event.ADDED_TO_STAGE, onAdded);
}

private function onAdded(e:Event):void
{
   var myPanel : Panel = new Panel();
   myPanel.width=100;
   myPanel.height=100;
   stage.addChild(myPanel); //nothing happens
}
]]
/fx:Script
fx:Declarations/fx:Declarations

/s:Application






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location: 
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives: 
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo%21 
Groups Links



flexcoders-fullfeatu...@yahoogroups.com 
mailto:flexcoders-fullfeatu...@yahoogroups.com





Garry Schafer
grimmwerks
gr...@grimmwerks.com mailto:gr...@grimmwerks.com
portfolio: www.grimmwerks.com/ http://www.grimmwerks.com/









--
Jeffry Houser
Technical Entrepreneur
203-379-0773
--
http://www.flextras.com?c=104
UI Flex Components: Tested! Supported! Ready!
--
http://www.theflexshow.com
http://www.jeffryhouser.com
http://www.asktheflexpert.com
--
Part of the DotComIt Brain Trust



[flexcoders] Re: Trying to pass a value to the mxml/swf file from java(android).How?

2011-09-22 Thread Shunmuga
you can pass the arguments to swf file by using Flashvars:
FlashVars=arg1=valarg2=val2

string htmlUrl = object width=\550\ height=\400\ param name=\movie\ 
value=\file:///android_asset/sample.swf\ embed 
src=\file:///android_asset/sample.swf\ FlashVars=arg1=valarg2=val2 
width=\550\ height=\400\ /embed/object;

In MXML file:

var flashVarsObj:Object = Application.application.parameters as Object;
arg1 = flashVarsObj.arg1;
arg2 = flashVarsObj.arg2;


Thanks, Rohini.

--- In flexcoders@yahoogroups.com, rawat rawatsaurabh@... wrote:

 HI, 
 I have been trying to pass the values to the mxml file(whose output is .swf 
 file) via android (java code) , But i am unable to do this.Here is my 
 problem, I think tht .SWF file is a binary file(like exe , .out or .dll or 
 .iso) which runs on flash platforms(browser, mobile phone supporting 
 flash).Now i want the output of the .swf to be dependent on some values which 
 I want to pass thourgh the android code.
 
 Other way is that I put the mxml files itself inside the eclipse(android 
 project IDE) and pass the values to it (don't know how) compile it using 
 mxmlc.exe compiler and link(don't know how ) with the android project and 
 generate the final output file(we call it apk) and run it.Please suggest me 
 which way to go even though my study is still partial but I am at the cross 
 roads of confusion.Please suggest me which way to go and how.
 Rgds,
 Saurabh





[flexcoders] How to detect device orientation state portrait or landscape

2011-09-22 Thread j2me_soul
How to detect device current orientation state ?portrait or landscape

[flexcoders] How to detect change of mobile orientation ? portrain

2011-09-22 Thread j2me_soul
How to detect change of  mobile orientation ? portrain or landscape

[flexcoders] Re: e4x help

2011-09-22 Thread DP
You're probably getting an e4x error on the first empty node (because Attribute 
doesn't exist there).

Try to avoid this issue by using the hasOwnAttribute function to make sure 
that Attribute actually exists in that node.  This probably isn't it, but 
it's close:

xmlRoot..(hasOwnAttribute(Attribute))

I'm not sure the above will work because we're not returning a specific level, 
but hopefully you get the idea.  Use the following URL for a great explanation 
of Advanced E4X:

http://joshblog.net/2007/06/29/getting-advanced-with-e4x/

Hope that helps...

--- In flexcoders@yahoogroups.com, michael_regert@... wrote:

 I must be missing something simple here.  I'm reading in XML that looks like 
 this:
 
 ?xml version=1.0 encoding=UTF-8?
 REGISTRY
   REGISTRY_DECLARATION/
   REGISTRY_ENTRIES
 Attribute
   AttributeNameAttr_1/AttributeName
 /Attribute
 Attribute
   AttributeNameAttr_2/AttributeName
 /Attribute
 Attribute
   AttributeNameAttr_3/AttributeName
 /Attribute
   /REGISTRY_ENTRIES
 /REGISTRY
 
 I'm trying to get all Atribute nodes using the .. operator, but it always 
 returns 0, even though xmlRoot looks fine.
 
 protected function xmlService_resultHandler(event:ResultEvent):void
 {
   if (event != null  event.result != null  event.result is XML) {
 var xmlRoot:XML = event.result as XML;
 if (xmlRoot  xmlRoot.length()  0) {
   var lst:XMLList = xmlRoot..Attribute;
   trace(lst length =  + lst.length());
 }
   }
 }
 
 
 Michael