[flexcoders] mxlm component instantiation using ActionScript

2010-03-12 Thread normc_actionscript
Is it possible/advisable to add an mxml component to the application by doing 
this from a Flex container:
var myComp:myCustomPanel = new myCustomPanel(); 
// myCustomPanel is myCustomPanel.mxml containing a Panel container.
AddChild(myComp)

On creation complete of myCustomPanel.mxml I attempt to set text in a 
 sub component, but error occurs at runtime.

Any other suggestions on how to pop up panels in the application? 
Popup manager?
Include them on application startup and toggle visibility?

Thanks,
Norm C.



[flexcoders] Re: Cairngorm Problem with Event and ModelLocator

2010-03-10 Thread normc_actionscript
Hi. Are those variabes bound?
var listUsers:ArrayCollection = model.listUsers;
var totalRows:int = model.countUsers;

I'm new to Cairngorm, so I'm not sure,off the top of my head, how to assign 
binding from a script. Within a component, it's done with squigly brackets {}.

Also, is your whole ModelLocator class marked as Bindable?



--- In flexcoders@yahoogroups.com, "txakin"  wrote:
>
> Hi guys,
> 
> I'm developing an application with Flex and using Cairngorm framework with 
> the events, commands, controller, delegates and the services for the remote 
> object, because my application will connect with a server side.
> 
> My component is like that:
> 
> http://www.adobe.com/2006/mxml";
>   creationComplete="initView()" width="100%">
> 
> The initView method will execute a CairngormEvent to access to the database 
> and get all the users from my system and how many users i have:
> 
> [Bindable]
> public var model:ModelLocator = ModelLocator.getInstance();
> 
> private function initView():void{
>//Find all the Users in the database
>var findAllUsersEvent:FindAllUsersEvent = 
>new FindAllUsersEvent();
>
>findAllUsersEvent.dispatch(); 
>var listUsers:ArrayCollection = model.listUsers;
>var totalRows:int = model.countUsers;
> }
> 
> Of course in my ModelLocator i have created the next properties:
> 
> public var listUsers:ArrayCollection
> public var countUsers:int;
> 
> In my command i call the method from the delegate to execute the correct 
> method of the remote object (it means of my java application running in the 
> server).
> 
> In the result method of the command, i assign the value of each properties.
> 
> If i debug the application, i get the correct results, but when i check the 
> value of 
> 
>var listUsers:ArrayCollection = model.listUsers;
>var totalRows:int = model.countUsers;
> 
> are not refreshed.
> I can imagine my problem is because Flex is asyncronous and when i assign the 
> values in the initView, maybe the Event is not yet finished.
> 
> How can i handle this kind of problem?
> I hope all of you have understood me...
> 
> Thanks in advance!!
>




[flexcoders] Re: newbie q: transition from flash to flex (long-ish)

2010-01-28 Thread normc_actionscript
I can't see how you would do it any differently.
Maybe you can take advantage of Flex's databinding is some way, not sure. I'm a 
bit of a newbie myself, so maybe others have more to say.
Norm

--- In flexcoders@yahoogroups.com, "ulrich"  wrote:
>
> Hi - 
> 
> I have a question how to approach a problem the flex way:
> 
> I have a quiz, I present a question with 4 answers in a panel.
> 
> In flash I would:
> 
> - create a custom component (logic and visual): new Component().
> 
> - pass a VO to init display and logic of component
> - add component to display list.
> - component knows when a selection was made: dispatches event
> - data model keeps track of results on main
> - custom component gets destroyed.
> 
> - new q gets presented: step 1.
> 
> 
> I know I could do it exactly like this in flex, but what would be Best 
> Practices to do this in Flex?
> 
> Thank you for your help!
> 
> U.
>




[flexcoders] Re: AS2 AttachMovie equivelant in AS3/Flex - SOLUTION: PRICELESS

2010-01-26 Thread normc_actionscript

See link for solution.

A  more accurate Subject line should have been:

Access / load library assets from another SWF


http://newmovieclip.wordpress.com/2007/08/23/access-load-library-assets-\
from-another-swf-in-flash-cs3/
<http://newmovieclip.wordpress.com/2007/08/23/access-load-library-assets\
-from-another-swf-in-flash-cs3/>





--- In flexcoders@yahoogroups.com, "normc_actionscript"
 wrote:
>
> My Flex app loads an external SWF via a SWFLoader.
> Said SWF contains movie clips in the library, with class definitions.
>
> In my Flex app, I do have the class name (a string) of the movie clips
in the SWF.
>
> How can I show those movie clips in my Flex app?
>
> Thanks!
>




[flexcoders] AS2 AttachMovie equivelant in AS3/Flex

2010-01-26 Thread normc_actionscript
My Flex app loads an external SWF via a SWFLoader.
Said SWF contains movie clips in the library, with class definitions.

In my Flex app, I do have the class name (a string) of the movie clips in the 
SWF.

How can I show those movie clips in my Flex app?

Thanks!



[flexcoders] Re: DataGrid is blank

2010-01-21 Thread normc_actionscript
Thanks for the help, makes sense. 
I'll make a new component with a List and label above, and repeat that. 
DataGrid is overkill for what's needed anyway.

Norm



[flexcoders] DataGrid is blank

2010-01-20 Thread normc_actionscript



My DataGrid contains data, but is now showing it. (See itemClickEvent
function.)

Anybody know why?

(PS feel free to critisize any other aspect of my code, i'm just
learning)

public function itemClickEvent(e:ListEvent):void{

Alert.show(String(e.target.selectedItem));

// THIS SHOWS WHAT'S EXPECTED

}

public function addToGrid(e:Event):void{

// This adds several 1 column dataGrids to an hbox, because I need lists
with column headers.

// One dataGrid won't work, because the lists are different lengths.





categories = new XMLList(urlLoader.data)



for each (var cat:XML in categories.*){

var partsGrid:DataGrid = new DataGrid();



var partsListCollection:XMLListCollection = new
XMLListCollection(cat.children())

var df:XML=XML(partsListCollection.getItemAt(0))

partsGrid.dataProvider = partsListCollection;



var dgc:DataGridColumn = new DataGridColumn();



dgc.headertext=c...@name.tostring();

dgc.dataField=df.name();

var cols:Array =new Array()

cols.push(dgc)

partsGrid.columns = cols;

gridHbox.addChild(partsGrid)

partsGrid.addEventListener(ListEvent.ITEM_CLICK, itemClickEvent)

partsGrid.validateNow()// just to show you that I tried this but it
doesn't work.

}





}



[flexcoders] Re: Starting with Cairngorm or PureMvc

2009-12-01 Thread normc_actionscript


I found Cairngorm to be more straight-forward.
I knew little about Flex. I looked at the Cairgorm store example and it's 
pretty obvious.

I took a good look at PureMVC, but had trouble imagining how to set up the 
application I want to build. So I decided on Cairngorm. 

I suggest reading the Cairngorm Version 3 Beta documentation online for a 
conceptual understanding. 

Norm

--- In flexcoders@yahoogroups.com, "Christophe"  
wrote:
>
> Hello, 
> 
> Is it easy to learn and use Cairngorm or PureMvc. I have a one year 
> application and I would like to use these frameworks to structured it.
> 
> Thank you,
> Christophe,
>




[flexcoders] Cairngorm store example - newbie binding question #2

2009-11-27 Thread normc_actionscript
Thank you Tracy for answering my previous question.

New one:
Why is 'handler' bound to 'confirmOrder' in this snippet?
 

confirmOrder is a function in the same file.
Is it just a way to set an initial value?

Thanks,
Norm



[flexcoders] cairngorm store example - newbie binding question

2009-11-25 Thread normc_actionscript

Greetings Flex pros:

In the modified cairngorm store (if you're familiar), file
ProductsAndCheckoutControlBar.mxml, there's: