Re: [flexcoders] Flash 9 - Flex 2 interface (previously): Can't we access MovieClips contained in embedded SWF's?
I'm sure that there will be more resources from Adobe as the Flash 9 IDE is released. That said, I suggest reading through this document: http://sdc.shockwave.com/devnet/flex/quickstart/embedding_assets/#EmbeddingSwfFiles . At 11:05 PM 2/16/2007, you wrote: Any Adobe or other people who have some resources out there for interfacing Flash 9 - Flex 2 apps? This seems to be a critical area, as Flash 9 IDE release looms.. Here's some interesting info on using Flash 9, but still not a solution to the Flex interface. http://www.adobe.com/devnet/flash/articles/flash9_as3_preview.htmlhttp://www.adobe.com/devnet/flash/articles/flash9_as3_preview.html -Scott On 2/16/07, slangeberg mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Mike, I tried setting up a document class for Flash 9, but when you place named items on stage, you get this error: ReferenceError: Error #1056: Cannot create property square_mc on com.cpile.flextoflash.FlexToFlashMain . at flash.display::Sprite/flash.display:Sprite::constructChildren() at flash.display::Sprite$iinit() at flash.display::MovieClip$iinit() at com.cpile.flextoflash::FlexToFlashMain$iinit() Adobe guys, is this correct? My understanding from looking around is that with the document class in Flash 9, you can only add items to the stage through code. That seems to negate a lot of the advantage of using a graphical interface... ok, so you could have a clip in your library that has the stage set up... hmmm that may do it! I'll write back when I have something. Otherwise, what i have sent is an effective way to access items on the stage. -Scott On 2/16/07, slangeberg mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Yeah, sorry. I'm not 100%, but you should be able to reference your loaded movie by that class type (your document class), from within Flex. I believe another gentleman referred to that, in this thread. Hold on, I did it, with a loader... I'll try to attach code. The proxy is just a design idea, meaning you define an interface to your movie in your class, instead of referencing elements within the movie from Flex. Then, the only thing that will break your flash / flex connection is to break that interface. For instance, your map(?) class could have functions like: showPlat( id:Object ); where the class implementation can decide what to do with the call, instead of having your flex app nose through the contents. That's a good design practice to get into: 'Always code to interfaces, not implementations.' Ok, so here's one of those do as I say, deals.. Also, my implementation may be a bit different here, than what we were talking about. This was a quick fix to enable custom loading logic, for the default Flex 2 application loading bar. In this case, I'm actually assigning the class under the 'linkage' option of my library clip (progress bar) to point to: com.tc.view.preload.ProgressBarSymbol, and publishing in Flash 9. Then, when you instantiate the class in Flex 2, you'll get a direct link. In your case, i would suggest a document class, for the entire movie. //I just used this class to enable me to access a loading bar quick. If this was going to //scale / change, I would have defined public methods to update this view. //I swear!! package com.tc.view.preload { import flash.display.*; import flash.text.TextField; [Embed(source=/library.swf, symbol=com.tc.view.preload.ProgressBarSymbol)] public class ProgressBarSymbol extends Sprite { public var progress_bar:MovieClip; public var loading_text:TextField; } } //And instantiated in Flex 2 by using: var bar:ProgressBarSymbol = new ProgressBarSymbol(); this.addChild( bar ); Hope this gives ideas, not confusion! -Scott On 2/16/07, Mike Anderson mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello Scott (in particular) :) You mentioned a Proxy - what you do mean by this exactly? Is this supposed to be some custom class that I write? If so, what is supposed to be contained within it? I did read up on the Document Object, and I am now doing my Flash 9 FLA files with a custom Document Class, representing the Root Timeline. I am pretty sure I did it right, since I am getting no compile errors. But my question is, is the AS3 Class File I used for the Document Object, strictly used for the FLA file? Or is this also used inside of Flex Builder, after I bring the external SWF file in? This is where I am getting a little confused. All the articles I find on this topic, covers the Flash side of things - and they never take that next step, and tell you how to reference it inside of Flex. If you have anything else on this topic, I'd really be grateful for your help. Thanks, Mike -- From: [EMAIL PROTECTED]http://ups.comups.com [mailto:flexcoders@ yahoogroups.com] On Behalf Of slangeberg Sent: Wednesday, February 14, 2007 10:53 AM To: [EMAIL
[flexcoders] Flash 9 - Flex 2 interface (previously): Can't we access MovieClips contained in embedded SWF's?
Any Adobe or other people who have some resources out there for interfacing Flash 9 - Flex 2 apps? This seems to be a critical area, as Flash 9 IDE release looms.. Here's some interesting info on using Flash 9, but still not a solution to the Flex interface. http://www.adobe.com/devnet/flash/articles/flash9_as3_preview.html -Scott On 2/16/07, slangeberg [EMAIL PROTECTED] wrote: Mike, I tried setting up a document class for Flash 9, but when you place named items on stage, you get this error: ReferenceError: Error #1056: Cannot create property square_mc on com.cpile.flextoflash.FlexToFlashMain . at flash.display::Sprite/flash.display:Sprite::constructChildren() at flash.display::Sprite$iinit() at flash.display::MovieClip$iinit() at com.cpile.flextoflash::FlexToFlashMain$iinit() Adobe guys, is this correct? My understanding from looking around is that with the document class in Flash 9, you can only add items to the stage through code. That seems to negate a lot of the advantage of using a graphical interface... ok, so you could have a clip in your library that has the stage set up... hmmm that may do it! I'll write back when I have something. Otherwise, what i have sent is an effective way to access items on the stage. -Scott On 2/16/07, slangeberg [EMAIL PROTECTED] wrote: Yeah, sorry. I'm not 100%, but you should be able to reference your loaded movie by that class type (your document class), from within Flex. I believe another gentleman referred to that, in this thread. Hold on, I did it, with a loader... I'll try to attach code. The proxy is just a design idea, meaning you define an interface to your movie in your class, instead of referencing elements within the movie from Flex. Then, the only thing that will break your flash / flex connection is to break that interface. For instance, your map(?) class could have functions like: showPlat( id:Object ); where the class implementation can decide what to do with the call, instead of having your flex app nose through the contents. That's a good design practice to get into: 'Always code to interfaces, not implementations.' Ok, so here's one of those do as I say, deals.. Also, my implementation may be a bit different here, than what we were talking about. This was a quick fix to enable custom loading logic, for the default Flex 2 application loading bar. In this case, I'm actually assigning the class under the 'linkage' option of my library clip (progress bar) to point to: com.tc.view.preload.ProgressBarSymbol, and publishing in Flash 9. Then, when you instantiate the class in Flex 2, you'll get a direct link. In your case, i would suggest a document class, for the entire movie. //I just used this class to enable me to access a loading bar quick. If this was going to //scale / change, I would have defined public methods to update this view. //I swear!! package com.tc.view.preload { import flash.display.*; import flash.text.TextField; [Embed(source=/library.swf, symbol= com.tc.view.preload.ProgressBarSymbol)] public class ProgressBarSymbol extends Sprite { public var progress_bar:MovieClip; public var loading_text:TextField; } } //And instantiated in Flex 2 by using: var bar:ProgressBarSymbol = new ProgressBarSymbol(); this.addChild( bar ); Hope this gives ideas, not confusion! -Scott On 2/16/07, Mike Anderson [EMAIL PROTECTED] wrote: Hello Scott (in particular) :) You mentioned a Proxy - what you do mean by this exactly? Is this supposed to be some custom class that I write? If so, what is supposed to be contained within it? I did read up on the Document Object, and I am now doing my Flash 9 FLA files with a custom Document Class, representing the Root Timeline. I am pretty sure I did it right, since I am getting no compile errors. But my question is, is the AS3 Class File I used for the Document Object, strictly used for the FLA file? Or is this also used inside of Flex Builder, after I bring the external SWF file in? This is where I am getting a little confused. All the articles I find on this topic, covers the Flash side of things - and they never take that next step, and tell you how to reference it inside of Flex. If you have anything else on this topic, I'd really be grateful for your help. Thanks, Mike -- *From:* flexcoders@yahoogroups.com [mailto:flexcoders@ yahoogroups.com] *On Behalf Of *slangeberg *Sent:* Wednesday, February 14, 2007 10:53 AM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Can't we access MovieClips contained in embedded SWF's? If you are using Flash 9, you can use a document class (I believe) at the root level and have Flex reference it by that. Your document class would set up an API, so you don't have to peer into the movie itself. Basically a proxy. Sorry I don't have the