LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-09-2009, 01:34 PM
borboletapicapa borboletapicapa is offline
Registered User
 
Join Date: Mar 2009
Location: Jamaica
Posts: 5
Rep Power: 0
borboletapicapa is on a distinguished road
Loading an external swf file

Good day to all flashers!

I have a flash site (as3) with many buttons, and each button loads an external .swf file.

I'm having some trouble on loading an external .swf file containing video.
I would like this video starts to work where you click on the button to open a corresponding video in the video player and stops wenn you click another button.

Any assistance would be most helpful.

My Code:

Actionscript:
import flash.events.MouseEvent;
import fl.transitions.*;
import fl.transitions.easing.*;


stop();

var sahne=root;
mainscroller.scroller.clip5.stop();

but1.dispatchEvent(new MouseEvent(MouseEvent.CLICK));

//this loader is used to load the external swf files
var loader:Loader;

//URLRequest stores the path to the file to be loaded
var urlRequest:URLRequest;

// _root.imagewidth defines the width of the image//


var imagewidth:Number;
var speed:Number;
var xposnew:Number;

sahne.imagewidth = 720;

// _root.speed defines the speed of the sliding images//

sahne.speed = 3;

/* _root.trig.xposnew defines the x position of the 
sliding images */

sahne.trig.xposnew = -(sahne.imagewidth);

//but1.dispatchEvent(new MouseEvent(MouseEvent.CLICK));

but1.addEventListener(MouseEvent.CLICK, buttonClicked);
but2.addEventListener(MouseEvent.CLICK, buttonClicked);
but3.addEventListener(MouseEvent.CLICK, buttonClicked);
but4.addEventListener(MouseEvent.CLICK, buttonClicked);
but5.addEventListener(MouseEvent.CLICK, buttonClicked);


function buttonClicked(evt:MouseEvent):void {
    loader = new Loader();
    
    if(evt.target == but1){
        sahne.trig.xposnew = -(sahne.imagewidth);
        urlRequest = new URLRequest("movieClips/page1.swf");
        loader.load(urlRequest);

    }
    
    else if(evt.target == but2){
        sahne.trig.xposnew = -((sahne.imagewidth)*2);
        urlRequest = new URLRequest("movieClips/page2.swf");
        loader.load(urlRequest);
        
    }
    
    else if(evt.target == but3){
        sahne.trig.xposnew = -((sahne.imagewidth)*3);
        urlRequest = new URLRequest("movieClips/page3.swf");
        loader.load(urlRequest);
        
    }
    
    else if(evt.target == but4){
        sahne.trig.xposnew = -((sahne.imagewidth)*4);
        urlRequest = new URLRequest("movieClips/page4.swf");
        loader.load(urlRequest);
        
    }
    
    else{
        sahne.trig.xposnew = -((sahne.imagewidth)*5);
        urlRequest = new URLRequest("movieClips/page5.swf");
        loader.load(urlRequest);
        
    }

    mainscroller.scroller.addChild(loader);
}  

//but1.dispatchEvent(new MouseEvent(MouseEvent.CLICK));

Last edited by FlashMove : 03-09-2009 at 11:22 PM
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading an external SWF dwsimms Newbies 0 08-11-2010 04:38 PM
CS3 and AS2: Embedding an external swf file deshg Newbies 2 11-11-2009 04:40 AM
Not showing dynamically loading korean texts from an external text file in PDA sunrays All Things Apple 1 08-21-2009 05:59 AM
Loading external swf into an MC of another swf?? malloy Flash CS3 / Flash 9 2 10-13-2007 12:30 PM
Loading an external swf in scrolling gallery. cazeroline Actionscript 2.0 5 02-03-2007 12:23 PM




All times are GMT. The time now is 08:31 AM.