
Welcome Guest
|
#1
|
|||
|
|||
|
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 |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |





