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"));
		//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)
			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

Who is Participating?
Look, that is so easy, create a sprite "holder"

var holder:Sprite = new Sprite();

add to stage


You can set location

holder.x = 560;
holder.y = 225;

Now load your SWF

                                           var fl_Loader:Loader;
            fl_Loader = new Loader();
            fl_Loader.load(new URLRequest("Questionnaire.swf"));
and attach to holder

ModifyMeAuthor Commented:
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 the end of the code in the onCompleteHandler function.
ModifyMeAuthor Commented:
Thx, had my head in my .... today.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.