House of Fusion
Home of the ColdFusion Community
Hostmysite VPS Hosting

Search flex

July 24, 2008

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Subscribe Now
Fusion Authority Quarterly Update - ColdFusion 8 Special Edition

For ColdFusion hosting try HostMySite.com.
Search over 2,500 ColdFusion resources here  >>>      
Home /  Groups /  Adobe Flex 2

Call function in child pod

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Scott Brady
04/29/2008 10:28 AM

(Sorry if this is a frequent question, I tried searching but didn't find anything that matched what I'm trying to do) My company's just getting started with Flex and I'm building an app based on the Adobe Dashboard sample app.  Basically, we have two tabs. The first tab shows a bunch of bar charts (they're all similar data, with different categories).  Two of the charts are going to be clickable -- when you click one, the other tab (the "Details" tab) will show up presenting the data in grid form.  The problem I'm having is I need to pass parameters into a function in that details display pod from the main mxml file.  I could probably accomplish it by running a function in the main mxml file, but I want all of my pods to be as independent as possible so other future dashboards could also use this pod. Here's basically what I'm doing.  Clicking the chart calls this function: ---------------- BEGIN CODE BLOCK ---------------- public function showDetailView():void {   var index:Number = 1;      StateManager.setViewIndex(index); // Save the view index.      viewStack.selectedIndex = index;   // If data exists then add the pods. After the pods have been added the data is cleared.   var podLayoutManager:PodLayoutManager = podLayoutManagers[index];   if (podDataDictionary[podLayoutManager] != null)     addPods(podLayoutManagers[index]); //  podLayoutManagers[index].items[0].getDetailData(); } -------------- END CODE BLOCK -------------- It's that last (commented-out) line where I'm trying to find a way to call the function. But, I can't figure out where in the document model that function would be, even after using watch expressions in the debugger. Is it simpler than I'm making it out to be?  Or, is there a better way to accomplish the same thing (keeping the pod as independent as possible)? Thanks in advance. Scott

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jeffry Houser
04/29/2008 10:57 AM

  Short answer:   Define properties (AKA Variables) in the subpod (AKA component).  Use parameter passing (potentially with data binding) to send variables from the "main" component into the subcomponent.   If you're using a ViewStack, keep in mind that the view probably won't be initialized until it is displayed, and accessing it will probably cause errors.   Not sure if this helps.  Your code sample is not enough for me to diagnose the problem. Scott Brady wrote: ----- Excess quoted text cut - see Original Post for more ----- -- Jeffry Houser Flex, ColdFusion, AIR AIM: Reboog711  | Phone: 1-203-379-0773 -- Adobe Community Expert <http://www.adobe.com/communities/experts/members/JeffryHouser.html>; My Company: <http://www.dot-com-it.com> My Podcast: <http://www.theflexshow.com> My Blog: <http://www.jeffryhouser.com>

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Stefan Richter
04/29/2008 11:25 AM

Good advice. You can set a creationpolicy on the viewstack too to make   sure everything gets initted right away. Regards, Stefan On 29 Apr 2008, at 15:57, Jeffry Houser wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tom Van den Eynde
04/30/2008 04:38 AM

You could consider using an MVC framework like PureMVC. It's ideal if you want to build different loosely coupled components. 'Notifications' are used to communicate amongst the different components. This way they don't need to be aware of the existance of each other. Be careful however with memory leaks (this is especially the case when you add & remove a lot of components from the display list)!

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Scott Brady
04/30/2008 09:52 AM

Thanks for all of the advice.  I think I'll go the "set bindable properties in the subcomponent" route, which seems somewhat safer. -- ----------------------------------------- Scott Brady http://www.scottbrady.net/

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Stefan Richter
05/07/2008 02:41 PM

Hi all, I have a file uploader for images in Flex. It submits to a CF script   which in turn returns an XML tree containing a list of all uploaded   files. Yesterday the system stopped working and I tracked it down to a single   image which had some strange characters in its filename (they looked   foreign, or at least not familiar). The filename of the uploaded image   broke my application. I'm sure this is an easy one: is there a CF function or similar I can   apply to the image name that would convert any non-conforming   characters t something that does not cause problems later on,   especially once the filename is included inside an XML structure? Right now this is how I write the XML:              <cfxml variable="userXML">                  <cfoutput>                  <brainwave action="#FORM.action#"   status="success">                            <cfloop query="fetchassets">                  <asset id="#id#" type="#assettype#" width="#width#"   height="#height#">                      <path>#path#</path>                  </asset>                  </cfloop>                  </brainwave>                  </cfoutput>              </cfxml> And here's my upload: <cffile action="upload" filefield="Filedata" destination="#clientdir#"   nameconflict="makeunique" /> Be gentle, I am from the Flash/Flex side of the fence so CF is not my   mother-tongue. Cheers Stefan


<< Previous Thread Today's Threads Next Thread >>

Mailing Lists