No longer able to set coordinates of external SWF.

Posted on 2011-05-10
Last Modified: 2012-05-11
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

Question by:ModifyMe

    Author Comment

    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.
    LVL 29

    Accepted Solution

    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


    Author Closing Comment

    Thx, had my head in my .... today.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
    I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
    In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
    The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now