Prev: Steve Jobs: Flash is no longer necessary
Next: When i choose the text tool , it's hang my FLASH CS4 for 10 to 15 mins
From: Rose on 4 May 2010 07:30 Hi I am creating ONE MCQ. I have created one custom component. In this component i have created four dynamic text. i hav to get the data in this dynamic text through xml. for this i hav created two class one is DisplayComponent and another is DisplayXml. code of DisplayComponent is: package com { import flash.display.MovieClip; public class DisplayComponent extends MovieClip { public var xmlObj:DisplayXml; public var comObj:mcqComponent=new mcqComponent(); public function DisplayComponent() { trace(comObj) addChild(comObj); comObj.x=300; comObj.y=200; xmlObj=new DisplayXml ; } } } where mcqComponent is our custom component. code of DisplayXml is : package com { import flash.net.*; import flash.net.URLLoader; import flash.net.URLRequest; import flash.display.MovieClip; import flash.events.Event; public class DisplayXml extends MovieClip { var loader:URLLoader; var myXML:XML; public function DisplayXml() { var url=new URLRequest("xmlData/ques.xml"); loader=new URLLoader(url); loader.addEventListener(Event.COMPLETE,onLoadComplete); } function onLoadComplete(event:Event):void { if (loader.data) { myXML=XML(loader.data); } } } } |