--- In flexcoders@yahoogroups.com, "Kelly" <[EMAIL PROTECTED]> wrote: > Why won't that work dynamically?
I don't know!! > Why are you making it of type Movie clip? I assumed that createChild returned a MovieClip. That's what it passes back to childLoaded, for example. > Why not cast it as a Button? Because Button is just an example. See below... > What are you trying to do? I'm trying to be able to load one of many different SWFs that derive from UIComponent. I don't know the type at compile time. Imagine something like Visio that lets you instantiate different objects on a drawing canvas, for instance. Thanks, Jason > _____ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of jasonstaczek > Sent: Wednesday, September 21, 2005 9:10 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Dynamically loading SWFs as children of Canvas > > > > Hi, > > I'm trying to dynamically load UIComponent-derived objects onto a > Canvas object and I'm seeing some behavior I don't understand. For > example, using a known class (Button) as a test, if I load it this > way: > > var mc:MovieClip = theCanvas.createChild(mx.controls.Button, > "someid", > {x:100, y:100}); > > ..everything works as expected. I get a Button on the canvas that > behaves like a proper child. > > However, that won't work dynamically, because I have to know > mx.controls.Button at compile time. So trying it this way: > > var mc:MovieClip = theCanvas.createChild > ("http://localhost:8700/flex/Button.swc.swf", "someid", {x:100, > y:100}); > > ..gives me different results. The Button appears as expected, but if > I resize the browser window, the Button resizes to enormous > proportions! I get no such weird resizing in the first case. > > What am I missing here? What does it take to make a proper > UIComponent- > derived object that can be loaded as a child of Canvas? > > Thanks, > > Jason > > > > > > > > > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders% 40yahoogroups.com > > > > > SPONSORED LINKS > > > Web > <http://groups.yahoo.com/gads? t=ms&k=Web+site+design+development&w1=Web+site > +design+development&w2=Computer+software+development&w3=Software+desi gn+and+ > development&w4=Macromedia+flex&w5=Software+development+best+practice& c=5&s=1 > 66&.sig=L-4QTvxB_quFDtMyhrQaHQ> site design development > > Computer > <http://groups.yahoo.com/gads? t=ms&k=Computer+software+development&w1=Web+si > te+design+development&w2=Computer+software+development&w3=Software+de sign+an > d+development&w4=Macromedia+flex&w5=Software+development+best+practic e&c=5&s > =166&.sig=lvQjSRfQDfWudJSe1lLjHw> software development > > Software > <http://groups.yahoo.com/gads? t=ms&k=Software+design+and+development&w1=Web+ > site+design+development&w2=Computer+software+development&w3=Software+ design+ > and+development&w4=Macromedia+flex&w5=Software+development+best+pract ice&c=5 > &s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ> design and development > > > Macromedia > <http://groups.yahoo.com/gads? t=ms&k=Macromedia+flex&w1=Web+site+design+deve > lopment&w2=Computer+software+development&w3=Software+design+and+devel opment& > w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.s ig=OO6n > PIrz7_EpZI36cYzBjw> flex > > Software > <http://groups.yahoo.com/gads? t=ms&k=Software+development+best+practice&w1=W > eb+site+design+development&w2=Computer+software+development&w3=Softwa re+desi > gn+and+development&w4=Macromedia+flex&w5=Software+development+best+pr actice& > c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw> development best practice > > > > > > _____ > > YAHOO! GROUPS LINKS > > > > * Visit your group "flexcoders > <http://groups.yahoo.com/group/flexcoders> " on the web. > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED] subject=Unsubscribe> > > * Your use of Yahoo! Groups is subject to the Yahoo! > <http://docs.yahoo.com/info/terms/> Terms of Service. > > > > _____ ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/