PDA

View Full Version : loadMovie help..



Darren_Clark
May 26th, 2008, 09:26 AM
Hi,


I am trying to create an empty movie clip which will then be used as the main content area for my portfolio. The size will be set at 623 x 320 and a number of different "movies" will then be triggered into it..

This is what I have so far (code added to the web button):

on(release){
loadMovie("transtest1.swf", "containermovie");
containermovie._width = 623;
containermovie._height = 320;
}


..and this is the portfolio (http://www.darrenclarkdesign.com/darren3.htm), as you can see it is not loading the "movie" as specified "transtest1.swf".

Can anybody please help? (I'm using CS3).


Thanks,

Darren

Felixz
May 26th, 2008, 09:55 AM
Maybe the problem is that u are resizing container before content actually loads (u can't resize empty MovieClips, because it gives weird behaivor) change the size onCompleteWrong forum, should be AS2

Darren_Clark
May 26th, 2008, 10:04 AM
I see.. How would I do this?

(Sorry I'm self taught in Flash and I am only just learning ActionScript!)

Alex Lexcuk
May 26th, 2008, 04:33 PM
first frame code


import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;

var ldr:Loader = new Loader();
var urlReq:URLRequest = new URLRequest("http://kind-armadillo.pochta.ru/FlaAC3/curve.swf");
ldr.load(urlReq);
ldr.contentLoaderInfo.addEventListener(Event.COMPL ETE, loaded);
//addChild(ldr);

function loaded(event:Event):Sprite
{
var content:Sprite = event.target.content;
content.scaleX = 0.15;
content.scaleY = 0.1;
return content;
}


var button_cont:Sprite = new Sprite();



var square:Sprite = new Sprite();
square.graphics.beginFill(0xFF,0.1);
square.graphics.drawRoundRect(0, 0, 100, 50, 10, 10);
square.graphics.endFill();

var square_1:Sprite = new Sprite();
square_1.graphics.beginFill(0xFF,1);
square_1.graphics.drawRoundRect(0, 0, 100, 50, 10, 10);
square_1.graphics.endFill();


var button_text:TextField= new TextField();
button_text.text="Move me";
button_text.selectable=false;

button_cont.addChild(ldr);
button_cont.addChild(square_1);
button_cont.addChild(button_text);
button_cont.addChild(square);


addChild(button_cont);
button_cont.buttonMode=true;

button_cont.addEventListener(MouseEvent.ROLL_OVER, media);
button_cont.addEventListener(MouseEvent.ROLL_OUT, media_out);
button_cont.addEventListener(MouseEvent.CLICK, media_click);

function media(Event: MouseEvent) {
// topPosition = my_gallery_container.numChildren - 1;
button_cont.setChildIndex(ldr, 2);
}

function media_out(Event: MouseEvent) {
// topPosition = my_gallery_container.numChildren - 1;
button_cont.setChildIndex(ldr, 0);
}

function media_click(Event: MouseEvent) {
button_text.text="Hi, all!!!\nFrom Alex Lexcuk!!!";
}

button_cont.x=100;
button_cont.y=100;

example
http://kind-armadillo.pochta.ru/FlaAC3/loadSWF.swf
http://kind-armadillo.pochta.ru/FlaAC3/loadSWF.rar

http://kind-armadillo.pochta.ru/FlaAC3/RotateSWF.swf
http://kind-armadillo.pochta.ru/FlaAC3/RotateSWF.rar

This example works in IE7
http://dnadillo.dn.ua/php_flash/MUS/Mus_1.html
http://dnadillo.dn.ua/php_flash/MUS/Mus_1.rar