RE: [flexcoders] Re: Passing params (flashvars) to sub-applications
You said, I was also able to pass a parameter in the url, and access it in the loaded app's creationComplete. That *is* using flashvars. Flashvars are passed into a swf via url parameters. The example you are quoting, which passes values from one fully instantiated application to another is not using flashvars. Maybe the title of that post is misleading, but it does say flashvar-*style*-parameters., meaning a dynamic Object. Note also that apps loaded by swfloader do behave differently than ordinary components, in this regard. Ordinary components evaluate the passed property values before creationComplete, so that those values can be used in the component setup. With a swf loaded APP, you must wait until it is complete before setting properties. Flashvars are ready by creationComplete. Tracy _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Richard Rodseth Sent: Wednesday, March 04, 2009 1:05 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Well, this is research and I'm trying all possibilities, but I suppose you could say the goal is to allow team A to embed team B's application in a tab with the minimum of disruption to either team. Team B's application is normally embedded in HTML and reads flashvars at startup (i.e. in a creation complete handler). I sort of expected SWFLoader to have a way to specify application parameters. In my googling, I found the link I referred to (in particular answer 2): http://stackoverflo http://stackoverflow.com/questions/407858/passing-flashvars-style-parameter s-to-a-loaded-swf w.com/questions/407858/passing-flashvars-style-parameters-to-a-loaded-swf But the sample code presented at the above link listens for an application completed event from the loaded app before setting any parameters, and it doesn't show how/when the embedded application reads the parameters. So, while I have a more type-safe technique as presented by Amy, I'm left wondering if there is a way to make a host application present the same context to the embedded app that SWFObject does when the host application is HTML. If you have successfully used flashvars *and* read them in a creationComplete handler I'd love to know how you did it. Presumably you set the flashvars earlier than the example I linked to above did. On Tue, Mar 3, 2009 at 6:28 PM, Tracy Spratt tspr...@lariatinc. mailto:tspr...@lariatinc.com com wrote: I am confused now, which method are you using? Are you attempting to pass values between the fully instantiated components, or are you trying to use flashvars? I have successfully use both approaches, but the last few posts have been dealing with using component lifecycle events to trigger directly setting a property on the loaded component. Using flashvars is the simplest, because the lifecycle events do not come into play, but is limited because you have to use strings. Exactly what is your goal? Tracy _ From: flexcod...@yahoogro mailto:flexcoders@yahoogroups.com ups.com [mailto:flexcod...@yahoogro mailto:flexcoders@yahoogroups.com ups.com] On Behalf Of Richard Rodseth Sent: Tuesday, March 03, 2009 8:09 PM To: flexcod...@yahoogro mailto:flexcoders@yahoogroups.com ups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Yes, that's what Amy's example does, and since I do control both apps, it seems that's probably the way to go. Nevertheless, I am curious, because a) there must be many apps one would like to embed that do something at startup that depends on a flashVar b) the literature on sub apps vs modules says that modules are used when there is shared code (though a single interface is not much shared code) c) Tracy said the StackOverflow technique worked for him So let me pose a question. If one does have such an application and it can't be modified, is it possible to write a host application that will allow it to load? On Tue, Mar 3, 2009 at 4:50 PM, Bjorn Schultheiss bjorn.mailinglists@ mailto:bjorn.mailingli...@gmail.com gmail.com wrote: The question begs. Why would you want to use the untyped params object to pass values between swf applications. why not just create a setter on the sub application and when its loaded the set the value on it via the parent application. use a common interface to get the setter method signature. Bjorn --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com, Tracy Spratt tspr...@... wrote: Those traces tell me it should be working, that the embedded app is ready when the host app attempts to communicate with it. Tracy _ From: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com [mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com] On Behalf Of Richard Rodseth Sent: Tuesday, March 03, 2009 6:42 PM To: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
Re: [flexcoders] Re: Passing params (flashvars) to sub-applications
Thanks for the clarification - most helpful. When I use SWFObject in HTML, I don't append the parameters to the URL, but I guess that's happing under the hood. Next experiment: Values of Application.application and parentApplication in a multi-application application :) In my latest experiment, I have discarded the quoted code, and just have a url parameter. I am setting the SWFLoader source in a creationComplete handler rather than when the SWFLoader is instantiated. What I am seeing is that I can access the url parameter within the loaded app's completion handler using this.parameters[config_id] but not Application.application.parameters[config_id] Within the loaded application (which does derive from UIComponent), parentApplication is null. So flashvars may be ready by creationComplete, but Application.application and this.parentApplication are not. Thanks again for the explanations. On Wed, Mar 4, 2009 at 12:16 PM, Tracy Spratt tspr...@lariatinc.com wrote: You said, “I was also able to pass a parameter in the url, and access it in the loaded app's creationComplete…” That **is** using flashvars. Flashvars are passed into a swf via url parameters. The example you are quoting, which passes values from one fully instantiated application to another is not using flashvars. Maybe the title of that post is misleading, but it does say “flashvar-**style**-parameters.”, meaning a dynamic “Object”. Note also that apps loaded by swfloader do behave differently than ordinary components, in this regard. Ordinary components evaluate the passed property values before creationComplete, so that those values can be used in the component setup. With a swf loaded APP, you must wait until it is complete before setting properties. Flashvars are ready by creationComplete. Tracy -- *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On Behalf Of *Richard Rodseth *Sent:* Wednesday, March 04, 2009 1:05 AM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Well, this is research and I'm trying all possibilities, but I suppose you could say the goal is to allow team A to embed team B's application in a tab with the minimum of disruption to either team. Team B's application is normally embedded in HTML and reads flashvars at startup (i.e. in a creation complete handler). I sort of expected SWFLoader to have a way to specify application parameters. In my googling, I found the link I referred to (in particular answer 2): http://stackoverflow.com/questions/407858/passing-flashvars-style-parameters-to-a-loaded-swf But the sample code presented at the above link listens for an application completed event from the loaded app before setting any parameters, and it doesn't show how/when the embedded application reads the parameters. So, while I have a more type-safe technique as presented by Amy, I'm left wondering if there is a way to make a host application present the same context to the embedded app that SWFObject does when the host application is HTML. If you have successfully used flashvars *and* read them in a creationComplete handler I'd love to know how you did it. Presumably you set the flashvars earlier than the example I linked to above did. On Tue, Mar 3, 2009 at 6:28 PM, Tracy Spratt tspr...@lariatinc.com wrote: I am confused now, which method are you using? Are you attempting to pass values between the fully instantiated components, or are you trying to use flashvars? I have successfully use both approaches, but the last few posts have been dealing with using component lifecycle events to trigger directly setting a property on the loaded component. Using flashvars is the simplest, because the lifecycle events do not come into play, but is limited because you have to use strings. Exactly what is your goal? Tracy -- *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On Behalf Of *Richard Rodseth *Sent:* Tuesday, March 03, 2009 8:09 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Yes, that's what Amy's example does, and since I do control both apps, it seems that's probably the way to go. Nevertheless, I am curious, because a) there must be many apps one would like to embed that do something at startup that depends on a flashVar b) the literature on sub apps vs modules says that modules are used when there is shared code (though a single interface is not much shared code) c) Tracy said the StackOverflow technique worked for him So let me pose a question. If one does have such an application and it can't be modified, is it possible to write a host application that will allow it to load? On Tue, Mar 3, 2009 at 4:50 PM, Bjorn Schultheiss bjorn.mailingli...@gmail.com
RE: [flexcoders] Re: Passing params (flashvars) to sub-applications
Application.application always points at the top-level application, not the local application. parentApplication I would expect to work. How are you determining it is null? You might try parentDocument. Tracy _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Richard Rodseth Sent: Wednesday, March 04, 2009 4:11 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Thanks for the clarification - most helpful. When I use SWFObject in HTML, I don't append the parameters to the URL, but I guess that's happing under the hood. Next experiment: Values of Application.application and parentApplication in a multi-application application :) In my latest experiment, I have discarded the quoted code, and just have a url parameter. I am setting the SWFLoader source in a creationComplete handler rather than when the SWFLoader is instantiated. What I am seeing is that I can access the url parameter within the loaded app's completion handler using this.parameters[config_id] but not Application.application.parameters[config_id] Within the loaded application (which does derive from UIComponent), parentApplication is null. So flashvars may be ready by creationComplete, but Application.application and this.parentApplication are not. Thanks again for the explanations. On Wed, Mar 4, 2009 at 12:16 PM, Tracy Spratt tspr...@lariatinc. mailto:tspr...@lariatinc.com com wrote: You said, I was also able to pass a parameter in the url, and access it in the loaded app's creationComplete. That *is* using flashvars. Flashvars are passed into a swf via url parameters. The example you are quoting, which passes values from one fully instantiated application to another is not using flashvars. Maybe the title of that post is misleading, but it does say flashvar-*style*-parameters., meaning a dynamic Object. Note also that apps loaded by swfloader do behave differently than ordinary components, in this regard. Ordinary components evaluate the passed property values before creationComplete, so that those values can be used in the component setup. With a swf loaded APP, you must wait until it is complete before setting properties. Flashvars are ready by creationComplete. Tracy _ From: flexcod...@yahoogro mailto:flexcoders@yahoogroups.com ups.com [mailto:flexcod...@yahoogro mailto:flexcoders@yahoogroups.com ups.com] On Behalf Of Richard Rodseth Sent: Wednesday, March 04, 2009 1:05 AM To: flexcod...@yahoogro mailto:flexcoders@yahoogroups.com ups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Well, this is research and I'm trying all possibilities, but I suppose you could say the goal is to allow team A to embed team B's application in a tab with the minimum of disruption to either team. Team B's application is normally embedded in HTML and reads flashvars at startup (i.e. in a creation complete handler). I sort of expected SWFLoader to have a way to specify application parameters. In my googling, I found the link I referred to (in particular answer 2): http://stackoverflo http://stackoverflow.com/questions/407858/passing-flashvars-style-parameter s-to-a-loaded-swf w.com/questions/407858/passing-flashvars-style-parameters-to-a-loaded-swf But the sample code presented at the above link listens for an application completed event from the loaded app before setting any parameters, and it doesn't show how/when the embedded application reads the parameters. So, while I have a more type-safe technique as presented by Amy, I'm left wondering if there is a way to make a host application present the same context to the embedded app that SWFObject does when the host application is HTML. If you have successfully used flashvars *and* read them in a creationComplete handler I'd love to know how you did it. Presumably you set the flashvars earlier than the example I linked to above did. On Tue, Mar 3, 2009 at 6:28 PM, Tracy Spratt tspr...@lariatinc. mailto:tspr...@lariatinc.com com wrote: I am confused now, which method are you using? Are you attempting to pass values between the fully instantiated components, or are you trying to use flashvars? I have successfully use both approaches, but the last few posts have been dealing with using component lifecycle events to trigger directly setting a property on the loaded component. Using flashvars is the simplest, because the lifecycle events do not come into play, but is limited because you have to use strings. Exactly what is your goal? Tracy _ From: flexcod...@yahoogro mailto:flexcoders@yahoogroups.com ups.com [mailto:flexcod...@yahoogro mailto:flexcoders@yahoogroups.com ups.com] On Behalf Of Richard Rodseth Sent: Tuesday, March 03, 2009 8:09 PM To: flexcod...@yahoogro mailto:flexcoders@yahoogroups.com ups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub
Re: [flexcoders] Re: Passing params (flashvars) to sub-applications
I saw in the debugger, and parentDocument was not null, though I forget what it was. I was just trying to think if there was a style apps could follow to be embeddable. But I think the type-safe interface-based non-flashvar approach might be the way to go in my case. Still not 100% clear on modules vs sub apps, but that a whole other topic... On Wed, Mar 4, 2009 at 3:49 PM, Tracy Spratt tspr...@lariatinc.com wrote: Application.application always points at the *top-level* application, not the “local” application. parentApplication I would expect to work. How are you determining it is null? You might try parentDocument. Tracy -- *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On Behalf Of *Richard Rodseth *Sent:* Wednesday, March 04, 2009 4:11 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Thanks for the clarification - most helpful. When I use SWFObject in HTML, I don't append the parameters to the URL, but I guess that's happing under the hood. Next experiment: Values of Application.application and parentApplication in a multi-application application :) In my latest experiment, I have discarded the quoted code, and just have a url parameter. I am setting the SWFLoader source in a creationComplete handler rather than when the SWFLoader is instantiated. What I am seeing is that I can access the url parameter within the loaded app's completion handler using this.parameters[config_id] but not Application.application.parameters[config_id] Within the loaded application (which does derive from UIComponent), parentApplication is null. So flashvars may be ready by creationComplete, but Application.application and this.parentApplication are not. Thanks again for the explanations. On Wed, Mar 4, 2009 at 12:16 PM, Tracy Spratt tspr...@lariatinc.com wrote: You said, “I was also able to pass a parameter in the url, and access it in the loaded app's creationComplete…” That **is** using flashvars. Flashvars are passed into a swf via url parameters. The example you are quoting, which passes values from one fully instantiated application to another is not using flashvars. Maybe the title of that post is misleading, but it does say “flashvar-**style**-parameters.”, meaning a dynamic “Object”. Note also that apps loaded by swfloader do behave differently than ordinary components, in this regard. Ordinary components evaluate the passed property values before creationComplete, so that those values can be used in the component setup. With a swf loaded APP, you must wait until it is complete before setting properties. Flashvars are ready by creationComplete. Tracy -- *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On Behalf Of *Richard Rodseth *Sent:* Wednesday, March 04, 2009 1:05 AM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Well, this is research and I'm trying all possibilities, but I suppose you could say the goal is to allow team A to embed team B's application in a tab with the minimum of disruption to either team. Team B's application is normally embedded in HTML and reads flashvars at startup (i.e. in a creation complete handler). I sort of expected SWFLoader to have a way to specify application parameters. In my googling, I found the link I referred to (in particular answer 2): http://stackoverflow.com/questions/407858/passing-flashvars-style-parameters-to-a-loaded-swf But the sample code presented at the above link listens for an application completed event from the loaded app before setting any parameters, and it doesn't show how/when the embedded application reads the parameters. So, while I have a more type-safe technique as presented by Amy, I'm left wondering if there is a way to make a host application present the same context to the embedded app that SWFObject does when the host application is HTML. If you have successfully used flashvars *and* read them in a creationComplete handler I'd love to know how you did it. Presumably you set the flashvars earlier than the example I linked to above did. On Tue, Mar 3, 2009 at 6:28 PM, Tracy Spratt tspr...@lariatinc.com wrote: I am confused now, which method are you using? Are you attempting to pass values between the fully instantiated components, or are you trying to use flashvars? I have successfully use both approaches, but the last few posts have been dealing with using component lifecycle events to trigger directly setting a property on the loaded component. Using flashvars is the simplest, because the lifecycle events do not come into play, but is limited because you have to use strings. Exactly what is your goal? Tracy -- *From
Re: [flexcoders] Re: Passing params (flashvars) to sub-applications
Thanks for the example, Amy. I was able to do this (on application complete in the host): loadedApp = event.target.application as Application; loadedApp[configid] = Default; and see the value in the loaded application. public function set configid(id:String):void { this.config_id = id; } I was also able to pass a parameter in the url, and access it in the loaded app's creationComplete via this.parameters[config_id] (not Application.application.parameters[config_id] But I have not been able to get this to work: loadedApp = event.target.application as Application; if(!loadedApp) throw new Error(); loadedApp.parameters[config_id] = Default; Loaded app's onCreationComplete() this.config_id = Application.application.parameters[config_id]; On Tue, Mar 3, 2009 at 6:35 AM, Amy amyblankens...@bellsouth.net wrote: --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Richard Rodseth rrods...@... wrote: I'm experimenting with loading sub applications using SWFLoader. I've read numerous posts about this, but for the life of me can't figure out how to pass flashvars to the sub application. In particular, the technique described here (the second one) doesn't work for me http://stackoverflow.com/questions/407858/passing-flashvars-style- parameters-to-a-loaded-swf Surely there's a definitive way to do this? Have you thought about just setting up getters and setters on your base class and calling those? This doesn't use getters and setters, but a getter or setter is just a function, so you can see how it would work: http://flexdiary.blogspot.com/2009/01/example-of-casting-contets-of- swfloader.html
RE: [flexcoders] Re: Passing params (flashvars) to sub-applications
Not sure when you tried the code that didn't work, but application is not available right away Alex Harui Flex SDK Developer Adobe Systems Inc.http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Richard Rodseth Sent: Tuesday, March 03, 2009 10:47 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Thanks for the example, Amy. I was able to do this (on application complete in the host): loadedApp = event.target.application as Application; loadedApp[configid] = Default; and see the value in the loaded application. public function set configid(id:String):void { this.config_id = id; } I was also able to pass a parameter in the url, and access it in the loaded app's creationComplete via this.parameters[config_id] (not Application.application.parameters[config_id] But I have not been able to get this to work: loadedApp = event.target.application as Application; if(!loadedApp) throw new Error(); loadedApp.parameters[config_id] = Default; Loaded app's onCreationComplete() this.config_id = Application.application.parameters[config_id]; On Tue, Mar 3, 2009 at 6:35 AM, Amy amyblankens...@bellsouth.netmailto:amyblankens...@bellsouth.net wrote: --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, Richard Rodseth rrods...@... wrote: I'm experimenting with loading sub applications using SWFLoader. I've read numerous posts about this, but for the life of me can't figure out how to pass flashvars to the sub application. In particular, the technique described here (the second one) doesn't work for me http://stackoverflow.com/questions/407858/passing-flashvars-style- parameters-to-a-loaded-swf Surely there's a definitive way to do this? Have you thought about just setting up getters and setters on your base class and calling those? This doesn't use getters and setters, but a getter or setter is just a function, so you can see how it would work: http://flexdiary.blogspot.com/2009/01/example-of-casting-contets-of- swfloader.html
Re: [flexcoders] Re: Passing params (flashvars) to sub-applications
It was on creation complete. On Tue, Mar 3, 2009 at 11:17 AM, Alex Harui aha...@adobe.com wrote: Not sure when you tried the code that didn’t work, but application is not available right away Alex Harui Flex SDK Developer Adobe Systems Inc. http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On Behalf Of *Richard Rodseth *Sent:* Tuesday, March 03, 2009 10:47 AM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Thanks for the example, Amy. I was able to do this (on application complete in the host): loadedApp = event.target.application as Application; loadedApp[configid] = Default; and see the value in the loaded application. public function set configid(id:String):void { this.config_id = id; } I was also able to pass a parameter in the url, and access it in the loaded app's creationComplete via this.parameters[config_id] (not Application.application.parameters[config_id] But I have not been able to get this to work: loadedApp = event.target.application as Application; if(!loadedApp) throw new Error(); loadedApp.parameters[config_id] = Default; Loaded app's onCreationComplete() this.config_id = Application.application.parameters[config_id]; On Tue, Mar 3, 2009 at 6:35 AM, Amy amyblankens...@bellsouth.net wrote: --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Richard Rodseth rrods...@... wrote: I'm experimenting with loading sub applications using SWFLoader. I've read numerous posts about this, but for the life of me can't figure out how to pass flashvars to the sub application. In particular, the technique described here (the second one) doesn't work for me http://stackoverflow.com/questions/407858/passing-flashvars-style- parameters-to-a-loaded-swf Surely there's a definitive way to do this? Have you thought about just setting up getters and setters on your base class and calling those? This doesn't use getters and setters, but a getter or setter is just a function, so you can see how it would work: http://flexdiary.blogspot.com/2009/01/example-of-casting-contets-of- swfloader.html
Re: [flexcoders] Re: Passing params (flashvars) to sub-applications
I just did a quick trace test, and the messages were written to the console in the following order: 1) SWFLoader load complete (registers listener for app complete) 2) embedded application creation complete handler 3) embedded application app complete handler 4) host app handler for embedded app app complete So presumably if one is setting parameters in 4) they can't be read in 3)... Tracy, are you following the recipe here (2nd answer)? http://stackoverflow.com/questions/407858/passing-flashvars-style- parameters-to-a-loaded-swf Seems to me this could only work if the loaded app is not accessing the parameters until some subsequent user gesture. On Tue, Mar 3, 2009 at 11:53 AM, Richard Rodseth rrods...@gmail.com wrote: It was on creation complete. On Tue, Mar 3, 2009 at 11:17 AM, Alex Harui aha...@adobe.com wrote: Not sure when you tried the code that didn’t work, but application is not available right away Alex Harui Flex SDK Developer Adobe Systems Inc. http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On Behalf Of *Richard Rodseth *Sent:* Tuesday, March 03, 2009 10:47 AM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Thanks for the example, Amy. I was able to do this (on application complete in the host): loadedApp = event.target.application as Application; loadedApp[configid] = Default; and see the value in the loaded application. public function set configid(id:String):void { this.config_id = id; } I was also able to pass a parameter in the url, and access it in the loaded app's creationComplete via this.parameters[config_id] (not Application.application.parameters[config_id] But I have not been able to get this to work: loadedApp = event.target.application as Application; if(!loadedApp) throw new Error(); loadedApp.parameters[config_id] = Default; Loaded app's onCreationComplete() this.config_id = Application.application.parameters[config_id]; On Tue, Mar 3, 2009 at 6:35 AM, Amy amyblankens...@bellsouth.net wrote: --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Richard Rodseth rrods...@... wrote: I'm experimenting with loading sub applications using SWFLoader. I've read numerous posts about this, but for the life of me can't figure out how to pass flashvars to the sub application. In particular, the technique described here (the second one) doesn't work for me http://stackoverflow.com/questions/407858/passing-flashvars-style- parameters-to-a-loaded-swf Surely there's a definitive way to do this? Have you thought about just setting up getters and setters on your base class and calling those? This doesn't use getters and setters, but a getter or setter is just a function, so you can see how it would work: http://flexdiary.blogspot.com/2009/01/example-of-casting-contets-of- swfloader.html
Re: [flexcoders] Re: Passing params (flashvars) to sub-applications
No, Event.INIT did not help. I wonder if it's because I'm running the host from Flexbuilder and the url passed to SWFLoader is a file URL. On Tue, Mar 3, 2009 at 3:47 PM, Bjorn Schultheiss bjorn.mailingli...@gmail.com wrote: Application.creationComplete should be fine. on your Loaders try Event.INIT I'm passing flashVars from shell to modules fine, don't see why there would be any hurdles with sub-applications. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Richard Rodseth rrods...@... wrote: I just did a quick trace test, and the messages were written to the console in the following order: 1) SWFLoader load complete (registers listener for app complete) 2) embedded application creation complete handler 3) embedded application app complete handler 4) host app handler for embedded app app complete So presumably if one is setting parameters in 4) they can't be read in 3)... Tracy, are you following the recipe here (2nd answer)? http://stackoverflow.com/questions/407858/passing-flashvars-style- parameters-to-a-loaded-swf Seems to me this could only work if the loaded app is not accessing the parameters until some subsequent user gesture. On Tue, Mar 3, 2009 at 11:53 AM, Richard Rodseth rrods...@... wrote: It was on creation complete. On Tue, Mar 3, 2009 at 11:17 AM, Alex Harui aha...@... wrote: Not sure when you tried the code that didn�t work, but application is not available right away Alex Harui Flex SDK Developer Adobe Systems Inc. http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui *From:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com[mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] *On Behalf Of *Richard Rodseth *Sent:* Tuesday, March 03, 2009 10:47 AM *To:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com *Subject:* Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Thanks for the example, Amy. I was able to do this (on application complete in the host): loadedApp = event.target.application as Application; loadedApp[configid] = Default; and see the value in the loaded application. public function set configid(id:String):void { this.config_id = id; } I was also able to pass a parameter in the url, and access it in the loaded app's creationComplete via this.parameters[config_id] (not Application.application.parameters[config_id] But I have not been able to get this to work: loadedApp = event.target.application as Application; if(!loadedApp) throw new Error(); loadedApp.parameters[config_id] = Default; Loaded app's onCreationComplete() this.config_id = Application.application.parameters[config_id]; On Tue, Mar 3, 2009 at 6:35 AM, Amy amyblankens...@... wrote: --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.com, Richard Rodseth rrodseth@ wrote: I'm experimenting with loading sub applications using SWFLoader. I've read numerous posts about this, but for the life of me can't figure out how to pass flashvars to the sub application. In particular, the technique described here (the second one) doesn't work for me http://stackoverflow.com/questions/407858/passing-flashvars-style- parameters-to-a-loaded-swf Surely there's a definitive way to do this? Have you thought about just setting up getters and setters on your base class and calling those? This doesn't use getters and setters, but a getter or setter is just a function, so you can see how it would work: http://flexdiary.blogspot.com/2009/01/example-of-casting-contets-of- swfloader.html
RE: [flexcoders] Re: Passing params (flashvars) to sub-applications
File:// will affect timing and can cause the trace order you are seeing. If you've set the source attribute of a child SWF in SWFLoader, it can load before the main app dispatches applicationComplete.If you set the source in applicationComplete then it will guarantee that the main app is done before the child ap loads. From http:// SWFs are streamed in so it will be harder to get the child SWF before the main app's applicationComplete, but not impossible so write code to defend against it. Alex Harui Flex SDK Developer Adobe Systems Inc.http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Richard Rodseth Sent: Tuesday, March 03, 2009 4:14 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub-applications No, Event.INIT did not help. I wonder if it's because I'm running the host from Flexbuilder and the url passed to SWFLoader is a file URL. On Tue, Mar 3, 2009 at 3:47 PM, Bjorn Schultheiss bjorn.mailingli...@gmail.commailto:bjorn.mailingli...@gmail.com wrote: Application.creationComplete should be fine. on your Loaders try Event.INIT I'm passing flashVars from shell to modules fine, don't see why there would be any hurdles with sub-applications. --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, Richard Rodseth rrods...@... wrote: I just did a quick trace test, and the messages were written to the console in the following order: 1) SWFLoader load complete (registers listener for app complete) 2) embedded application creation complete handler 3) embedded application app complete handler 4) host app handler for embedded app app complete So presumably if one is setting parameters in 4) they can't be read in 3)... Tracy, are you following the recipe here (2nd answer)? http://stackoverflow.com/questions/407858/passing-flashvars-style- parameters-to-a-loaded-swf Seems to me this could only work if the loaded app is not accessing the parameters until some subsequent user gesture. On Tue, Mar 3, 2009 at 11:53 AM, Richard Rodseth rrods...@... wrote: It was on creation complete. On Tue, Mar 3, 2009 at 11:17 AM, Alex Harui aha...@... wrote: Not sure when you tried the code that didn�t work, but application is not available right away Alex Harui Flex SDK Developer Adobe Systems Inc. http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui *From:* flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com] *On Behalf Of *Richard Rodseth *Sent:* Tuesday, March 03, 2009 10:47 AM *To:* flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com *Subject:* Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Thanks for the example, Amy. I was able to do this (on application complete in the host): loadedApp = event.target.application as Application; loadedApp[configid] = Default; and see the value in the loaded application. public function set configid(id:String):void { this.config_id = id; } I was also able to pass a parameter in the url, and access it in the loaded app's creationComplete via this.parameters[config_id] (not Application.application.parameters[config_id] But I have not been able to get this to work: loadedApp = event.target.application as Application; if(!loadedApp) throw new Error(); loadedApp.parameters[config_id] = Default; Loaded app's onCreationComplete() this.config_id = Application.application.parameters[config_id]; On Tue, Mar 3, 2009 at 6:35 AM, Amy amyblankens...@... wrote: --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com flexcoders%40yahoogroups.comhttp://40yahoogroups.com, Richard Rodseth rrodseth@ wrote: I'm experimenting with loading sub applications using SWFLoader. I've read numerous posts about this, but for the life of me can't figure out how to pass flashvars to the sub application. In particular, the technique described here (the second one) doesn't work for me http://stackoverflow.com/questions/407858/passing-flashvars-style- parameters-to-a-loaded-swf Surely there's a definitive way to do this? Have you thought about just setting up getters and setters on your base class and calling those? This doesn't use getters and setters, but a getter or setter is just a function, so you can see how it would work: http://flexdiary.blogspot.com/2009/01/example-of-casting-contets-of- swfloader.html
RE: [flexcoders] Re: Passing params (flashvars) to sub-applications
Those traces tell me it should be working, that the embedded app is ready when the host app attempts to communicate with it. Tracy _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Richard Rodseth Sent: Tuesday, March 03, 2009 6:42 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub-applications I just did a quick trace test, and the messages were written to the console in the following order: 1) SWFLoader load complete (registers listener for app complete) 2) embedded application creation complete handler 3) embedded application app complete handler 4) host app handler for embedded app app complete So presumably if one is setting parameters in 4) they can't be read in 3)... Tracy, are you following the recipe here (2nd answer)? http://stackoverflo http://stackoverflow.com/questions/407858/passing-flashvars-style- w.com/questions/407858/passing-flashvars-style-parameters-to-a-loaded-swf Seems to me this could only work if the loaded app is not accessing the parameters until some subsequent user gesture. On Tue, Mar 3, 2009 at 11:53 AM, Richard Rodseth rrods...@gmail. mailto:rrods...@gmail.com com wrote: It was on creation complete. On Tue, Mar 3, 2009 at 11:17 AM, Alex Harui aha...@adobe. mailto:aha...@adobe.com com wrote: Not sure when you tried the code that didn't work, but application is not available right away Alex Harui Flex SDK Developer Adobe Systems Inc. http://www.adobe.com/ Blog: http://blogs. http://blogs.adobe.com/aharui adobe.com/aharui From: flexcod...@yahoogro mailto:flexcoders@yahoogroups.com ups.com [mailto:flexcod...@yahoogro mailto:flexcoders@yahoogroups.com ups.com] On Behalf Of Richard Rodseth Sent: Tuesday, March 03, 2009 10:47 AM To: flexcod...@yahoogro mailto:flexcoders@yahoogroups.com ups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Thanks for the example, Amy. I was able to do this (on application complete in the host): loadedApp = event.target.application as Application; loadedApp[configid] = Default; and see the value in the loaded application. public function set configid(id:String):void { this.config_id = id; } I was also able to pass a parameter in the url, and access it in the loaded app's creationComplete via this.parameters[config_id] (not Application.application.parameters[config_id] But I have not been able to get this to work: loadedApp = event.target.application as Application; if(!loadedApp) throw new Error(); loadedApp.parameters[config_id] = Default; Loaded app's onCreationComplete() this.config_id = Application.application.parameters[config_id]; On Tue, Mar 3, 2009 at 6:35 AM, Amy amyblankenship@ mailto:amyblankens...@bellsouth.net bellsouth.net wrote: --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com, Richard Rodseth rrods...@... wrote: I'm experimenting with loading sub applications using SWFLoader. I've read numerous posts about this, but for the life of me can't figure out how to pass flashvars to the sub application. In particular, the technique described here (the second one) doesn't work for me http://stackoverflo http://stackoverflow.com/questions/407858/passing-flashvars-style- w.com/questions/407858/passing-flashvars-style- parameters-to-a-loaded-swf Surely there's a definitive way to do this? Have you thought about just setting up getters and setters on your base class and calling those? This doesn't use getters and setters, but a getter or setter is just a function, so you can see how it would work: http://flexdiary. http://flexdiary.blogspot.com/2009/01/example-of-casting-contets-of- blogspot.com/2009/01/example-of-casting-contets-of- swfloader.html
Re: [flexcoders] Re: Passing params (flashvars) to sub-applications
Yes, that's what Amy's example does, and since I do control both apps, it seems that's probably the way to go. Nevertheless, I am curious, because a) there must be many apps one would like to embed that do something at startup that depends on a flashVar b) the literature on sub apps vs modules says that modules are used when there is shared code (though a single interface is not much shared code) c) Tracy said the StackOverflow technique worked for him So let me pose a question. If one does have such an application and it can't be modified, is it possible to write a host application that will allow it to load? On Tue, Mar 3, 2009 at 4:50 PM, Bjorn Schultheiss bjorn.mailingli...@gmail.com wrote: The question begs. Why would you want to use the untyped params object to pass values between swf applications. why not just create a setter on the sub application and when its loaded the set the value on it via the parent application. use a common interface to get the setter method signature. Bjorn --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Tracy Spratt tspr...@... wrote: Those traces tell me it should be working, that the embedded app is ready when the host app attempts to communicate with it. Tracy _ From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On Behalf Of Richard Rodseth Sent: Tuesday, March 03, 2009 6:42 PM To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub-applications I just did a quick trace test, and the messages were written to the console in the following order: 1) SWFLoader load complete (registers listener for app complete) 2) embedded application creation complete handler 3) embedded application app complete handler 4) host app handler for embedded app app complete So presumably if one is setting parameters in 4) they can't be read in 3)... Tracy, are you following the recipe here (2nd answer)? http://stackoverflo http://stackoverflow.com/questions/407858/passing-flashvars-style- w.com/questions/407858/passing-flashvars-style-parameters-to-a-loaded-swf Seems to me this could only work if the loaded app is not accessing the parameters until some subsequent user gesture. On Tue, Mar 3, 2009 at 11:53 AM, Richard Rodseth rrods...@gmail. mailto:rrods...@... com wrote: It was on creation complete. On Tue, Mar 3, 2009 at 11:17 AM, Alex Harui aha...@adobe. mailto:aha...@... com wrote: Not sure when you tried the code that didn't work, but application is not available right away Alex Harui Flex SDK Developer Adobe Systems Inc. http://www.adobe.com/ Blog: http://blogs. http://blogs.adobe.com/aharui adobe.com/aharui From: flexcod...@yahoogro mailto:flexcoders@yahoogroups.comflexcoders%40yahoogroups.com ups.com [mailto:flexcod...@yahoogro mailto:flexcoders@yahoogroups.comflexcoders%40yahoogroups.com ups.com] On Behalf Of Richard Rodseth Sent: Tuesday, March 03, 2009 10:47 AM To: flexcod...@yahoogro mailto:flexcoders@yahoogroups.comflexcoders%40yahoogroups.com ups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Thanks for the example, Amy. I was able to do this (on application complete in the host): loadedApp = event.target.application as Application; loadedApp[configid] = Default; and see the value in the loaded application. public function set configid(id:String):void { this.config_id = id; } I was also able to pass a parameter in the url, and access it in the loaded app's creationComplete via this.parameters[config_id] (not Application.application.parameters[config_id] But I have not been able to get this to work: loadedApp = event.target.application as Application; if(!loadedApp) throw new Error(); loadedApp.parameters[config_id] = Default; Loaded app's onCreationComplete() this.config_id = Application.application.parameters[config_id]; On Tue, Mar 3, 2009 at 6:35 AM, Amy amyblankenship@ mailto:amyblankens...@... bellsouth.net wrote: --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.comflexcoders%2540yahoogroups.com ups.com, Richard Rodseth rrodseth@ wrote: I'm experimenting with loading sub applications using SWFLoader. I've read numerous posts about this, but for the life of me can't figure out how to pass flashvars to the sub application. In particular, the technique described here (the second one) doesn't work for me http://stackoverflo http://stackoverflow.com/questions/407858/passing-flashvars-style- w.com/questions/407858/passing-flashvars-style- parameters-to-a-loaded-swf Surely there's a definitive way to do this? Have you thought about just setting up getters
RE: [flexcoders] Re: Passing params (flashvars) to sub-applications
I am confused now, which method are you using? Are you attempting to pass values between the fully instantiated components, or are you trying to use flashvars? I have successfully use both approaches, but the last few posts have been dealing with using component lifecycle events to trigger directly setting a property on the loaded component. Using flashvars is the simplest, because the lifecycle events do not come into play, but is limited because you have to use strings. Exactly what is your goal? Tracy _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Richard Rodseth Sent: Tuesday, March 03, 2009 8:09 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Yes, that's what Amy's example does, and since I do control both apps, it seems that's probably the way to go. Nevertheless, I am curious, because a) there must be many apps one would like to embed that do something at startup that depends on a flashVar b) the literature on sub apps vs modules says that modules are used when there is shared code (though a single interface is not much shared code) c) Tracy said the StackOverflow technique worked for him So let me pose a question. If one does have such an application and it can't be modified, is it possible to write a host application that will allow it to load? On Tue, Mar 3, 2009 at 4:50 PM, Bjorn Schultheiss bjorn.mailinglists@ mailto:bjorn.mailingli...@gmail.com gmail.com wrote: The question begs. Why would you want to use the untyped params object to pass values between swf applications. why not just create a setter on the sub application and when its loaded the set the value on it via the parent application. use a common interface to get the setter method signature. Bjorn --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com, Tracy Spratt tspr...@... wrote: Those traces tell me it should be working, that the embedded app is ready when the host app attempts to communicate with it. Tracy _ From: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com [mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com] On Behalf Of Richard Rodseth Sent: Tuesday, March 03, 2009 6:42 PM To: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub-applications I just did a quick trace test, and the messages were written to the console in the following order: 1) SWFLoader load complete (registers listener for app complete) 2) embedded application creation complete handler 3) embedded application app complete handler 4) host app handler for embedded app app complete So presumably if one is setting parameters in 4) they can't be read in 3)... Tracy, are you following the recipe here (2nd answer)? http://stackoverflo http://stackoverflo http://stackoverflow.com/questions/407858/passing-flashvars-style- w.com/questions/407858/passing-flashvars-style- w.com/questions/ http://w.com/questions/407858/passing-flashvars-style-parameters-to-a-loade d-swf 407858/passing-flashvars-style-parameters-to-a-loaded-swf Seems to me this could only work if the loaded app is not accessing the parameters until some subsequent user gesture. On Tue, Mar 3, 2009 at 11:53 AM, Richard Rodseth rrods...@gmail. mailto:rrods...@... com wrote: It was on creation complete. On Tue, Mar 3, 2009 at 11:17 AM, Alex Harui aha...@adobe. mailto:aha...@... com wrote: Not sure when you tried the code that didn't work, but application is not available right away Alex Harui Flex SDK Developer Adobe Systems Inc. http://www.adobe. http://www.adobe.com/ com/ Blog: http://blogs. http://blogs. http://blogs.adobe.com/aharui adobe.com/aharui adobe.com/aharui From: flexcod...@yahoogro mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com ups.com [mailto:flexcod...@yahoogro mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com ups.com] On Behalf Of Richard Rodseth Sent: Tuesday, March 03, 2009 10:47 AM To: flexcod...@yahoogro mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com ups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Thanks for the example, Amy. I was able to do this (on application complete in the host): loadedApp = event.target.application as Application; loadedApp[configid] = Default; and see the value in the loaded application. public function set configid(id:String):void { this.config_id = id; } I was also able to pass a parameter in the url, and access it in the loaded app's creationComplete via this.parameters[config_id] (not Application.application.parameters[config_id] But I have not been able to get this to work: loadedApp = event.target.application as Application
Re: [flexcoders] Re: Passing params (flashvars) to sub-applications
Well, this is research and I'm trying all possibilities, but I suppose you could say the goal is to allow team A to embed team B's application in a tab with the minimum of disruption to either team. Team B's application is normally embedded in HTML and reads flashvars at startup (i.e. in a creation complete handler). I sort of expected SWFLoader to have a way to specify application parameters. In my googling, I found the link I referred to (in particular answer 2): http://stackoverflow.com/questions/407858/passing-flashvars-style-parameters-to-a-loaded-swf But the sample code presented at the above link listens for an application completed event from the loaded app before setting any parameters, and it doesn't show how/when the embedded application reads the parameters. So, while I have a more type-safe technique as presented by Amy, I'm left wondering if there is a way to make a host application present the same context to the embedded app that SWFObject does when the host application is HTML. If you have successfully used flashvars *and* read them in a creationComplete handler I'd love to know how you did it. Presumably you set the flashvars earlier than the example I linked to above did. On Tue, Mar 3, 2009 at 6:28 PM, Tracy Spratt tspr...@lariatinc.com wrote: I am confused now, which method are you using? Are you attempting to pass values between the fully instantiated components, or are you trying to use flashvars? I have successfully use both approaches, but the last few posts have been dealing with using component lifecycle events to trigger directly setting a property on the loaded component. Using flashvars is the simplest, because the lifecycle events do not come into play, but is limited because you have to use strings. Exactly what is your goal? Tracy -- *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On Behalf Of *Richard Rodseth *Sent:* Tuesday, March 03, 2009 8:09 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Re: Passing params (flashvars) to sub-applications Yes, that's what Amy's example does, and since I do control both apps, it seems that's probably the way to go. Nevertheless, I am curious, because a) there must be many apps one would like to embed that do something at startup that depends on a flashVar b) the literature on sub apps vs modules says that modules are used when there is shared code (though a single interface is not much shared code) c) Tracy said the StackOverflow technique worked for him So let me pose a question. If one does have such an application and it can't be modified, is it possible to write a host application that will allow it to load? On Tue, Mar 3, 2009 at 4:50 PM, Bjorn Schultheiss bjorn.mailingli...@gmail.com wrote: The question begs. Why would you want to use the untyped params object to pass values between swf applications. why not just create a setter on the sub application and when its loaded the set the value on it via the parent application. use a common interface to get the setter method signature. Bjorn --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Tracy Spratt tspr...@... wrote: Those traces tell me it should be working, that the embedded app is ready when the host app attempts to communicate with it. Tracy _ From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On Behalf Of Richard Rodseth Sent: Tuesday, March 03, 2009 6:42 PM To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Subject: Re: [flexcoders] Re: Passing params (flashvars) to sub-applications I just did a quick trace test, and the messages were written to the console in the following order: 1) SWFLoader load complete (registers listener for app complete) 2) embedded application creation complete handler 3) embedded application app complete handler 4) host app handler for embedded app app complete So presumably if one is setting parameters in 4) they can't be read in 3)... Tracy, are you following the recipe here (2nd answer)? http://stackoverflo http://stackoverflow.com/questions/407858/passing-flashvars-style- w.com/questions/407858/passing-flashvars-style-parameters-to-a-loaded-swf Seems to me this could only work if the loaded app is not accessing the parameters until some subsequent user gesture. On Tue, Mar 3, 2009 at 11:53 AM, Richard Rodseth rrods...@gmail. mailto:rrods...@... com wrote: It was on creation complete. On Tue, Mar 3, 2009 at 11:17 AM, Alex Harui aha...@adobe. mailto:aha...@... com wrote: Not sure when you tried the code that didn't work, but application is not available right away Alex Harui Flex SDK Developer Adobe Systems Inc. http://www.adobe.com/ Blog: http://blogs. http