Link to home
Start Free TrialLog in
Avatar of ModifyMe
ModifyMe

asked on

No longer able to set coordinates of external SWF.

Hello Experts,

I had to restructure my original post, so here I go...

I have a SWF file that its X,Y coordinates were set to 560,225 respectively.  Then I added an Event Listener and the coordinates no longer take effect and my SWF is placed at 0,0.

I've even placed the code into the onCompleteHandler function, with no luck.  I would appreciate some help on fixing this.

function quizFunc(arg1):void
{
		var xmlData:XML = new XML(arg1);
		
		var fl_Loader:Loader;
		fl_Loader = new Loader();
		fl_Loader.load(new URLRequest("Questionnaire.swf"));
		addChild(fl_Loader);
		
		//This following two lines did work... 
		//until the 'addEventListener' was added below, now the SWF is at (0,0)
		fl_Loader.x=560;//Does not work, though tracing out fl_Loader.x does reflect the value
		fl_Loader.y=225;//Does not work, though tracing out fl_Loader.y does reflect the value

		fl_Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);	
		function onCompleteHandler(loadEvent:Event)
		{
			addChild(loadEvent.currentTarget.content);
			loadEvent.currentTarget.content.questionText_txt.text = xmlData.questionType[0].question[0].@text;
			loadEvent.currentTarget.content.q1_txt.text = xmlData.questionType[0].question[0].possibleAnswer[0].@text;
			loadEvent.currentTarget.content.q2_txt.text = xmlData.questionType[0].question[0].possibleAnswer[1].@text;
			loadEvent.currentTarget.content.q3_txt.text = xmlData.questionType[0].question[0].possibleAnswer[2].@text;
			loadEvent.currentTarget.content.q4_txt.text = xmlData.questionType[0].question[0].possibleAnswer[3].@text;			
		}
}

Open in new window

Avatar of ModifyMe
ModifyMe

ASKER

How dumb of me for something so simple.  I tried MANY different ways since yesterday pulling my hair and it was something as simple as placing:
var xFL = loadEvent.currentTarget.content.x;
var yFL = loadEvent.currentTarget.content.y;

Open in new window

...at the end of the code in the onCompleteHandler function.
ASKER CERTIFIED SOLUTION
Avatar of dgofman
dgofman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thx, had my head in my .... today.