tag:blogger.com,1999:blog-1450791674252564527.post8412104549105819401..comments2011-06-09T13:13:46.226+05:30Comments on Mayur Bais: sprites in mxmlUnknownnoreply@blogger.comBlogger16125tag:blogger.com,1999:blog-1450791674252564527.post-58358270417365558312010-12-18T02:50:45.886+05:302010-12-18T02:50:45.886+05:30Thank you soo much!! I've been trying to get s...Thank you soo much!! I've been trying to get something like this to work for hours..and I just couldn't figure out why. And the examples in the docs were not helping.<br />This was a great help!Anonymoushttps://www.blogger.com/profile/00172834169954614484noreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-27330987425679316952010-07-01T01:16:31.697+05:302010-07-01T01:16:31.697+05:30Thanks a lot for the example and explanation.
It...Thanks a lot for the example and explanation. <br /><br />It took me a lot of time finding a real and easy solution.Michaelhttps://www.blogger.com/profile/12638937302583040238noreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-87189153587848837372010-06-03T09:39:45.474+05:302010-06-03T09:39:45.474+05:30Thanks a lot!!!!!!!!!!! you just ended more than 2...Thanks a lot!!!!!!!!!!! you just ended more than 2 hours of researching.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-70111346256769456222009-03-12T10:03:00.000+05:302009-03-12T10:03:00.000+05:30Correct! you are right..But sprite more at a lower...Correct! you are right..<BR/>But sprite more at a lower level then UIComponent..and this is just a example.. how to make use of your sprite extending custom components in your mxmls'. <BR/>(Just a demo to solve problem.. adding circle to mxml was not a actual problem)Mayurhttps://www.blogger.com/profile/03181975907828954727noreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-43294513920600248112009-03-12T01:08:00.000+05:302009-03-12T01:08:00.000+05:30or You could just define Your circle as ui compone...or You could just define Your circle as ui component<BR/><BR/>var circle1: UIComponent = new UIComponent();<BR/>circle1.graphics.beginFill(bgColor); <BR/>...michelekhttps://www.blogger.com/profile/17661628697560256283noreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-16737906121459174252008-12-19T10:16:00.000+05:302008-12-19T10:16:00.000+05:30Yes you are right..everything like.. flexloader.. ...Yes you are right..everything like.. flexloader.. etc things can not be added directly ..we need a uicomponent.. to actually add it to our any other visual component.. <BR/><BR/>and also.. the properties like height and width.. needs to be set for both..for sprite that is added and the uicomponent that is holding this spriteMayurhttps://www.blogger.com/profile/03181975907828954727noreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-52917614354643701772008-12-18T23:27:00.000+05:302008-12-18T23:27:00.000+05:30Thanks for this. The API documentation and code co...Thanks for this. The API documentation and code complete are very misleading when they indicate the following;<BR/>addChild(child:DisplayObject)<BR/>Sprite descends from DisplayObject so you would think that you could add it without having to use a UIComponentPhil Chttps://www.blogger.com/profile/06094503580393741933noreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-64128233209866543162008-09-24T01:22:00.000+05:302008-09-24T01:22:00.000+05:30You save me (^.^)^ !!You save me (^.^)^ !!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-37939082018016641112008-08-23T19:07:00.000+05:302008-08-23T19:07:00.000+05:30Thanks a lot, at last a useful example for people ...Thanks a lot, at last a useful example for people that for people that come from Flash and are trying Flex!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-60932525701469172932008-03-02T09:11:00.000+05:302008-03-02T09:11:00.000+05:30Another thing I've noticed is that when drawing to...Another thing I've noticed is that when drawing to the sprite, you can draw outside the parent container. For instance, if you create the UIComponent inside a Panel, you can draw outside the panel. Is there a way to mask drawing to the parent container? I tried things like ref.mask = ref, but it has no effect.Chrishttps://www.blogger.com/profile/00504016337495286197noreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-64318933770102147982008-02-28T10:31:00.000+05:302008-02-28T10:31:00.000+05:30thats correct!I am glad that you got it :)thats correct!<BR/>I am glad that you got it :)Mayurhttps://www.blogger.com/profile/03181975907828954727noreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-44450797313644683482008-02-28T06:40:00.000+05:302008-02-28T06:40:00.000+05:30Again, thanks! I also found that the UIComponent w...Again, thanks! I also found that the UIComponent won't regain focus if the browser loses focus, so I also need to bind it to Event.ACTIVATE.Chrishttps://www.blogger.com/profile/00504016337495286197noreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-82504536253579196222008-02-27T11:05:00.000+05:302008-02-27T11:05:00.000+05:30hi chris...you have to set focus to component to ...hi chris...<BR/>you have to set focus to component to invoke event handlers on it...<BR/>this works..<BR/>ref.setFocus(); // ref is the ui component in which u are adding sprite..<BR/><BR/>and then <BR/><BR/>ref.addEventListener(KeyboardEvent.KEY_DOWN,onKeyHandnler,false,0,true);<BR/><BR/><BR/>function onKeyHandnler(e){<BR/> mx.controls.Alert.show("Sprite clicked");<BR/> trace("dfgdf");<BR/> }<BR/><BR/>there is a "KeyboardEventExample" class given in flex help..<BR/>that does exactly what u are trying to do...<BR/><BR/>let me know if this helps youMayurhttps://www.blogger.com/profile/03181975907828954727noreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-14268958001226587222008-02-27T08:10:00.000+05:302008-02-27T08:10:00.000+05:30On a similar note, how can children of the UICompo...On a similar note, how can children of the UIComponent capture user input like KeyboardEvents? For example, if I instantiate a class that inherits Sprite, I can draw to it just fine like in your example. However, doing something like:<BR/><BR/>addEventListener(KeyboardEvent.KEY_DOWN, mySprite.onKeyHandler, false, 0, true);<BR/><BR/>doesn't seem to ever get called.Chrishttps://www.blogger.com/profile/00504016337495286197noreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-88017478313507011322008-02-19T10:08:00.000+05:302008-02-19T10:08:00.000+05:30I am glad.. that it helped somebody :)I am glad.. that it helped somebody :)Mayurhttps://www.blogger.com/profile/03181975907828954727noreply@blogger.comtag:blogger.com,1999:blog-1450791674252564527.post-52407468460297895032008-02-19T05:51:00.000+05:302008-02-19T05:51:00.000+05:30Thank you for posting this! I've been looking ever...Thank you for posting this! I've been looking everywhere for a simple example of how to draw shapes inside MXML, and no one seems to know how to do it! Thank you for clarifying this so simply!Chrishttps://www.blogger.com/profile/00504016337495286197noreply@blogger.com