views:

315

answers:

2

ok guys a question, can this be done or has it already been done, or can someone point me in the right direction (be aware i an a total newbie with action script)

i have a main swf movie about 600px x 400 px

what i want is this to run for say 30 seconds, then i want a countdown timer in the bottom corner for say 10 seconds, after this i want it to randomly load another swf file over the top of the original, and then the timer repeats for 10 seconds and repates the random loading of another swf file over the top etc, etc, etc

so whats the best way around this

A: 

It's possible. If you're comfortable with the basic syntax and grammar of AS3, then after adding the following topics to your toolbox, you should be ready.

1) Timers

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/Timer.html

2) Loaders

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html

3) Math.random()

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Math.html

In summary what I'd suggest would be to:

  • set up a Timer which fires every N seconds
  • when it fires, use a Loader to start loading a file whose file-name has been either generated or retrieved using a random number
danyal
A: 

hi danyal, i have the similar issue.but the difference is i have .swf files done by 3rd party, i have to parse xml to get swf files, it has to play one after the other. but it plays one file and stops, i tried to unload the content of 1st file. but bfore playing the file it is unloading it.how to get the play time of swf file.they are of different sizes and diff framerates. plz help me with an example.

private function resultHandler(event:ResultEvent):void { var xml:XMLList=XMLList(event.result).children();

        for each(lists in xml)
        {
            listofVideos=lists.list;

            for(var i:int=0;i<listofVideos.length();i++)
            {
                list_text.addItem(listofVideos[i].@listtext);
                videoAC.addItem(listofVideos[i].@listvideo);

            }

         }  
         startLoad();
    }
     private function startLoad():void
    {
        if(count<videoAC.length-1)
        {
         var url:String=videoAC[count+=1];
         trace(count+" url is..."+url);
         request=new URLRequest(url);
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler);
         loader.load(request);  
        }
    }


    private function completeHandler(event:Event):void
    {
        myComponent.addChild(loader.content);
        trace(loader.content);
        myContainer.addChild(myComponent);
        trace("playing...");
        clearcurrentSWF();

    }     
     private function clearcurrentSWF():void
     {
        trace("it is unloaded");
        myComponent.removeChild(loader.content);
     }
madhu