Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2010
    Thanked 0 Times in 0 Posts

    SWF Loader and MovieClip problems

    Hello all.
    I am using the following code to import a swf file that has a number or frames. When i hit next or previous it moves either to the next or previous frame.

    The code is as follows

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="load()">
    private var flashMovie:MovieClip;

    private function initMovie():void{
    flashMovie = loader.content as MovieClip;
    private function load():void{
    <mx:SWFLoader id="loader" source="flash.swf" complete="initMovie()"/>
    <mx:Button label="Next" click="flashMovie.nextFrame()"/>
    <mx:Button label="Previous" click="flashMovie.prevFrame()"/>
    This works fine, everything is as i want, apart from i want what ever SWF frame is being displayed, to be displayed on all web browsers that have the page open.

    I imagine i would be able to use an XML file, and pull the frame being displayed from that and have it check the XML file every couple of seconds ?

    Although saying that im not 100% sure on how to achieve this.

    Can anyone offer some help please?

  2. AdSlot6
  3. #2
    New Coder
    Join Date
    Mar 2010
    Thanked 0 Times in 0 Posts
    Ok, So i have been working on this concerpt a little more.

    I have created a HTTPS service,

    <mx:HTTPService id="getImage" result="handleImage(event)" url="change.xml" method="POST">
    <mx:request xmlns="">
    This pulling data from the XML file where i plan to store the frame that needs to be displayed on of the SWF file.

    I checked that the HTTP service was working by using the function

    private function handleImage(event:ResultEvent):void
    img1.source = event.result.imagelocation;
    And as i expected when i change the xml file, the image changes.

    However i created a variable

    private var i:String = "test";

    And planned to have the HTTP service change the value of this value. I assumed it would be the same code as what i previously used,so used the following code

    private function handleImage(event:ResultEvent):void
    var i = event.result.imagelocation;
    However using this, it dosent update the value of the variable being displayed in the text box,

    <mx:Text x="817" y="10" text="Total: {i}" width="157"/>

    Can anyone see where i am going wrong ?

  4. #3
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Florida, USA
    Thanked 406 Times in 398 Posts
    Do you have "i" set to bindable with the meta tag?
    private var i:String = "test";
    Also, try making "i" public, and tracing the value of "i" & the return from the HTTPService inside of your function that is updating the value.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts