Re: [Flashcoders] Re: attachMovie vs createClassObject
createClassObject and createObject (and a few more) methods are defined in the mx.core.ext.UIObjectExtensions class, and are added to MovieClip's prototype when UIObjectExtensions gets 'initialized'. This happens, if you have a UIComponent in your library. So createClassObject method will work, ONLY if you got a UIComponent based on macromedia's V2 architecture in your library. createClassObject essentially boils down to a attachMovie internall. I think the createClassObject ( and subsequently createObject) implement a 'enhanced' depthTable, which basically helps the components like ComboBox work properly. Its bedtime for me ( its singapore standard time here!), (and thanks to the beer :P ), so I can't write any more. Hope all the above info helps you. regards, Arul Prasad. On 3/26/07, Andy Herrman <[EMAIL PROTECTED]> wrote: I think the root movie clip does extend UIObject, as createClassObject works for me. And the objects I'm creating aren't custom ones, but things like mx.controls.ComboBox, so I don't have to worry about symbol* variables. I may have to look into UIObject a bit more. I've been making some of my own controls, but doing it using Composition, with the class that handles the control creating (or being passed) an movie clip to use. Maybe extending UIObject would make more sense. -Andy On 3/24/07, Yehia Shouman <[EMAIL PROTECTED]> wrote: > createClassObject is defined in UIObject core object. I don't think it can > be called as a method of any movieclip. It also requires that you define > > static var symbolName : String = "linkageID"; > static var symbolOwner : Object = com.myclass; > > > and at the end of the day It calls createObject which basically uses > attachMovie passing on the symbolName. Use it if your host mc is a UIObject > (inheriting from mx.core.UIComponent or mx.core.UIObject). > > I use > var myInstance:ClassType=ClassType(mc.attachMovie(ClassType.symbolName > ,"instanceName",depth)) > > Sometimes, if there is any pending code in the draw method of the created > class instance, I wait for a frame using doLater. > > I hope this helps > Yehia Shouman > > On 3/23/07, Andy Herrman <[EMAIL PROTECTED]> wrote: > > > > Just to amend my previous comment, in the case where I said > > `createClassObject()` failed but `attachMovie()` didn't, that ended up > > to be not quite true. `createClassObject()` didn't do anything, but > > `attachMovie()` created the visual portions of the clip, but it looks > > like none of the component's code was actually loaded, so while it > > appeared to be working it really wasn't. > > > > But in the cases where one works the other seems to work as well, so > > I'm still wondering what the difference is. > > > >-Andy > > > > On 3/20/07, Andy Herrman <[EMAIL PROTECTED]> wrote: > > > I'm wondering if there are any significant differences between using > > > `attachMovie()` and `createClassObject()` for creating components (I'm > > > targeting for Flash 7). I just ran into a weird issue creating a > > > ComboBox where I was using `createClassObject()` to instantiate it, > > > but saw that elsewhere in the code it was using `attachMovie()` to > > > create one, and both were working. > > > > > > Specifically, both this: > > > mc.attachMovie("ComboBox", "myComboBox", mc.getNextHighestDepth()); > > > and this: > > > mc.createClassObject(ComboBox, "myComboBox", mc.getNextHighestDepth ()); > > > > > > seems to give the same results in most cases. Is there any benefit to > > > using `createClassObject()` over `attachMovie()` for components? > > > > > > The one situation I ran into where it gives different results is when > > > using multiple SWFs from different places. I have a main movie which > > > loads another movie that contains all the UI resources (makes branding > > > easier). The UI resources movie contains the ComboBox in its library. > > > If both the movies are on the local filesystem then it works fine, > > > but if the resources SWF is on a remote web server the > > > `createClassObject()` call fails. However, if I change it to use > > > `attachMovie()` it works fine. So I'm leaning towards using > > > `attachMovie()`, just to make my life easier for testing (don't have > > > to upload the main movie every time I want to test it), but I'm > > > wondering if that will cause issues later. > > > > > >-Andy > > > > > ___ > > Flashcoders@chattyfig.figleaf.com > > To change your subscription options or search the archive: > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > Brought to you by Fig Leaf Software > > Premier Authorized Adobe Consulting and Training > > http://www.figleaf.com > > http://training.figleaf.com > > > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf S
Re: [Flashcoders] Re: attachMovie vs createClassObject
I think the root movie clip does extend UIObject, as createClassObject works for me. And the objects I'm creating aren't custom ones, but things like mx.controls.ComboBox, so I don't have to worry about symbol* variables. I may have to look into UIObject a bit more. I've been making some of my own controls, but doing it using Composition, with the class that handles the control creating (or being passed) an movie clip to use. Maybe extending UIObject would make more sense. -Andy On 3/24/07, Yehia Shouman <[EMAIL PROTECTED]> wrote: createClassObject is defined in UIObject core object. I don't think it can be called as a method of any movieclip. It also requires that you define static var symbolName : String = "linkageID"; static var symbolOwner : Object = com.myclass; and at the end of the day It calls createObject which basically uses attachMovie passing on the symbolName. Use it if your host mc is a UIObject (inheriting from mx.core.UIComponent or mx.core.UIObject). I use var myInstance:ClassType=ClassType(mc.attachMovie(ClassType.symbolName ,"instanceName",depth)) Sometimes, if there is any pending code in the draw method of the created class instance, I wait for a frame using doLater. I hope this helps Yehia Shouman On 3/23/07, Andy Herrman <[EMAIL PROTECTED]> wrote: > > Just to amend my previous comment, in the case where I said > `createClassObject()` failed but `attachMovie()` didn't, that ended up > to be not quite true. `createClassObject()` didn't do anything, but > `attachMovie()` created the visual portions of the clip, but it looks > like none of the component's code was actually loaded, so while it > appeared to be working it really wasn't. > > But in the cases where one works the other seems to work as well, so > I'm still wondering what the difference is. > >-Andy > > On 3/20/07, Andy Herrman <[EMAIL PROTECTED]> wrote: > > I'm wondering if there are any significant differences between using > > `attachMovie()` and `createClassObject()` for creating components (I'm > > targeting for Flash 7). I just ran into a weird issue creating a > > ComboBox where I was using `createClassObject()` to instantiate it, > > but saw that elsewhere in the code it was using `attachMovie()` to > > create one, and both were working. > > > > Specifically, both this: > > mc.attachMovie("ComboBox", "myComboBox", mc.getNextHighestDepth()); > > and this: > > mc.createClassObject(ComboBox, "myComboBox", mc.getNextHighestDepth()); > > > > seems to give the same results in most cases. Is there any benefit to > > using `createClassObject()` over `attachMovie()` for components? > > > > The one situation I ran into where it gives different results is when > > using multiple SWFs from different places. I have a main movie which > > loads another movie that contains all the UI resources (makes branding > > easier). The UI resources movie contains the ComboBox in its library. > > If both the movies are on the local filesystem then it works fine, > > but if the resources SWF is on a remote web server the > > `createClassObject()` call fails. However, if I change it to use > > `attachMovie()` it works fine. So I'm leaning towards using > > `attachMovie()`, just to make my life easier for testing (don't have > > to upload the main movie every time I want to test it), but I'm > > wondering if that will cause issues later. > > > >-Andy > > > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Re: attachMovie vs createClassObject
createClassObject is defined in UIObject core object. I don't think it can be called as a method of any movieclip. It also requires that you define static var symbolName : String = "linkageID"; static var symbolOwner : Object = com.myclass; and at the end of the day It calls createObject which basically uses attachMovie passing on the symbolName. Use it if your host mc is a UIObject (inheriting from mx.core.UIComponent or mx.core.UIObject). I use var myInstance:ClassType=ClassType(mc.attachMovie(ClassType.symbolName ,"instanceName",depth)) Sometimes, if there is any pending code in the draw method of the created class instance, I wait for a frame using doLater. I hope this helps Yehia Shouman On 3/23/07, Andy Herrman <[EMAIL PROTECTED]> wrote: Just to amend my previous comment, in the case where I said `createClassObject()` failed but `attachMovie()` didn't, that ended up to be not quite true. `createClassObject()` didn't do anything, but `attachMovie()` created the visual portions of the clip, but it looks like none of the component's code was actually loaded, so while it appeared to be working it really wasn't. But in the cases where one works the other seems to work as well, so I'm still wondering what the difference is. -Andy On 3/20/07, Andy Herrman <[EMAIL PROTECTED]> wrote: > I'm wondering if there are any significant differences between using > `attachMovie()` and `createClassObject()` for creating components (I'm > targeting for Flash 7). I just ran into a weird issue creating a > ComboBox where I was using `createClassObject()` to instantiate it, > but saw that elsewhere in the code it was using `attachMovie()` to > create one, and both were working. > > Specifically, both this: > mc.attachMovie("ComboBox", "myComboBox", mc.getNextHighestDepth()); > and this: > mc.createClassObject(ComboBox, "myComboBox", mc.getNextHighestDepth()); > > seems to give the same results in most cases. Is there any benefit to > using `createClassObject()` over `attachMovie()` for components? > > The one situation I ran into where it gives different results is when > using multiple SWFs from different places. I have a main movie which > loads another movie that contains all the UI resources (makes branding > easier). The UI resources movie contains the ComboBox in its library. > If both the movies are on the local filesystem then it works fine, > but if the resources SWF is on a remote web server the > `createClassObject()` call fails. However, if I change it to use > `attachMovie()` it works fine. So I'm leaning towards using > `attachMovie()`, just to make my life easier for testing (don't have > to upload the main movie every time I want to test it), but I'm > wondering if that will cause issues later. > >-Andy > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] Re: attachMovie vs createClassObject
Just to amend my previous comment, in the case where I said `createClassObject()` failed but `attachMovie()` didn't, that ended up to be not quite true. `createClassObject()` didn't do anything, but `attachMovie()` created the visual portions of the clip, but it looks like none of the component's code was actually loaded, so while it appeared to be working it really wasn't. But in the cases where one works the other seems to work as well, so I'm still wondering what the difference is. -Andy On 3/20/07, Andy Herrman <[EMAIL PROTECTED]> wrote: I'm wondering if there are any significant differences between using `attachMovie()` and `createClassObject()` for creating components (I'm targeting for Flash 7). I just ran into a weird issue creating a ComboBox where I was using `createClassObject()` to instantiate it, but saw that elsewhere in the code it was using `attachMovie()` to create one, and both were working. Specifically, both this: mc.attachMovie("ComboBox", "myComboBox", mc.getNextHighestDepth()); and this: mc.createClassObject(ComboBox, "myComboBox", mc.getNextHighestDepth()); seems to give the same results in most cases. Is there any benefit to using `createClassObject()` over `attachMovie()` for components? The one situation I ran into where it gives different results is when using multiple SWFs from different places. I have a main movie which loads another movie that contains all the UI resources (makes branding easier). The UI resources movie contains the ComboBox in its library. If both the movies are on the local filesystem then it works fine, but if the resources SWF is on a remote web server the `createClassObject()` call fails. However, if I change it to use `attachMovie()` it works fine. So I'm leaning towards using `attachMovie()`, just to make my life easier for testing (don't have to upload the main movie every time I want to test it), but I'm wondering if that will cause issues later. -Andy ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com