Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-09-2007, 08:51 PM   #1
kakkojak
Registered User
 
Join Date: Jul 2007
Posts: 8
Unhappy Load Movie with width & height?

Hi all,

I have a problem to set width, height and align for my load movie file,

thats a swf file (video file)

loadMovieNum("sos.swf", 1);
_width = 640;
_height = 480;
_align = centre;

Many thanks
kakkojak is offline   Reply With Quote
Old 07-09-2007, 11:42 PM   #2
atomic
Banned by AS.org Staff
 
Join Date: Jan 2007
Location: Montréal, Québec
Posts: 14,073
Default

You can't set a movie's properties loaded on a level, until you sure it's fully loaded. You need to use some preloading code, and only set the properties when the movie is fully loaded... And thus certainely not on the same actionscript as the loadMovieNum action.
atomic is offline   Reply With Quote
Old 07-10-2007, 05:00 PM   #3
kakkojak
Registered User
 
Join Date: Jul 2007
Posts: 8
Default

Thanks for replied Automic,

btw its not for online use.. just for for ofline use, any idea to change the setting for load movie files, since i cant edit from the fla coz the file was convert from avi to swf,

Really apreciate if someone can help me
kakkojak is offline   Reply With Quote
Old 07-10-2007, 05:05 PM   #4
sophistikat
Game On
 
sophistikat's Avatar
 
Join Date: Mar 2005
Location: Barrie, ON
Posts: 2,535
Default

what are you using MX or Flash 5?
__________________
Available freelancer
http://www.outsidethecubicle.ca
sophistikat is offline   Reply With Quote
Old 07-10-2007, 05:12 PM   #5
kakkojak
Registered User
 
Join Date: Jul 2007
Posts: 8
Default

Im using Flash MX version 6, Is it possible sophistikat?
kakkojak is offline   Reply With Quote
Old 07-10-2007, 05:19 PM   #6
sophistikat
Game On
 
sophistikat's Avatar
 
Join Date: Mar 2005
Location: Barrie, ON
Posts: 2,535
Default

_align center, do you mean, align to the center of the stage?
ActionScript Code:
var home = this; home.createEmptyMovieClip("video_mc", home.getNextHighestDepth()); home.createEmptyMovieClip("oe_mc", home.getNextHighestDepth()); video_mc.loadMovie('sos.swf'); oe_mc.onEnterFrame = function () {    if (video_mc._width > 0)    {       removeMovieClip(oe_mc);       video_mc._width = 640;       video_mc._height = 480;       video_mc._x = (Stage.width / 2) - (video_mc._width / 2);       video_mc._y = (Stage.height / 2) - (video_mc._height / 2);    } }
review the code... i'll explain what i did in about 10min
__________________
Available freelancer
http://www.outsidethecubicle.ca
sophistikat is offline   Reply With Quote
Old 07-10-2007, 05:32 PM   #7
sophistikat
Game On
 
sophistikat's Avatar
 
Join Date: Mar 2005
Location: Barrie, ON
Posts: 2,535
Default code: explained

ActionScript Code:
var home = this;
flash doesn't have a good memory and every time your use this, _parent or _root, flash has to look up the reference. if you use a variable to reference your timeline, flash will always know were to look.

+
ActionScript Code:
home.createEmptyMovieClip("video_mc", home.getNextHighestDepth()); home.createEmptyMovieClip("oe_mc", home.getNextHighestDepth());
we create two place holders. one for your external movie clip and one so that we can check if your .swf is loaded.

+
ActionScript Code:
video_mc.loadMovie('sos.swf');
begin loading your file...

+
ActionScript Code:
oe_mc.onEnterFrame = function () {    if (video_mc._width > 0)    {       removeMovieClip(oe_mc);       video_mc._width = 640;       video_mc._height = 480;       video_mc._x = (Stage.width / 2) - (video_mc._width / 2);       video_mc._y = (Stage.height / 2) - (video_mc._height / 2);    } }
initiate a loop onto our movieclip. as it continues to loop, onEnterFrame in an endless loop unless stopped, we want to check if the width of the video_mc is greater than 0; An empty movie clip's width is 0, once any data is loaded, its width is adjusted to the contents.

Once the width has chanced, we want to remove the oe_mc movieclip, remvoing stops the loop automatically, and then you can treating the video_mc movieclip like any other movieclip... change its properties, add properties, adjust its alpha, add funcations etc. etc.
__________________
Available freelancer
http://www.outsidethecubicle.ca
sophistikat is offline   Reply With Quote
Old 07-10-2007, 06:28 PM   #8
kakkojak
Registered User
 
Join Date: Jul 2007
Posts: 8
Default

thanks sophistikat

have tried it on hard way, but doesnt go well, mayb im not good enought to understand your script, can i get sample fla file from you.
kakkojak is offline   Reply With Quote
Old 07-10-2007, 07:25 PM   #9
sophistikat
Game On
 
sophistikat's Avatar
 
Join Date: Mar 2005
Location: Barrie, ON
Posts: 2,535
Default

i'm on a mac right now and i don't have Flash MX with me, only Flash 8 and I can only go back to Flash MX2004. If you have MX2004, you can save it for MX??
__________________
Available freelancer
http://www.outsidethecubicle.ca
sophistikat is offline   Reply With Quote
Old 07-10-2007, 07:45 PM   #10
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

How fortunate I am to have FMX 2004... (Will I ever get F8 here??? Not sure about that... )

I have created a sample based upon sophistikat's code... I had to hard code the depth since getNextHighestDepth() does not work in F6 though...
Oh, you will need to test it with the HTML file since you won't get the proper Stage.width/Stage.height value properly within the Flash IDE...
Attached Files
File Type: zip sosLoadMovie.zip (9.8 KB, 659 views)
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...

Last edited by CyanBlue; 07-10-2007 at 09:04 PM.
CyanBlue is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Variable thebutterfly ActionScript 2.0 72 01-24-2006 03:12 PM
Loading images in different frames.. nchagial ActionScript 2.0 22 12-21-2005 08:06 AM
load movie into another movie anbis ActionScript 1.0 (and below) 0 07-27-2004 02:14 PM
load movie specific frame: no solution works jubal44 ActionScript 2.0 3 05-24-2004 09:59 AM
load movie and "the" buttons srlem ActionScript 1.0 (and below) 2 11-28-2002 04:08 PM


All times are GMT. The time now is 09:35 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.