Groups | Blog | Home
all groups > flash (macromedia) > july 2004 >

flash (macromedia) : how to resize movie in javascript?


flash beginner
7/4/2004 10:50:49 PM
I have a movie in a html page named "MyTopMovie.swf", and an html button
"Next Movie". On button click, I want javascript to do the following:
(1). load "MyLoadMovie.swf" into "MyTopMovie.swf"
(2). resize the size of top movie from 300x300 to the size of loaded
movie

Can I do these in javascript? If not, how to do it in action script?
Thanks.
tutsamewasa
7/5/2004 6:56:02 AM
You must have something like this in HTML to show your flash movie
in HTML.

<OBJECT classid="clsid:DcbcbB6E-AE6D-11cf-96B8-4433454354000"
WIDTH="100%" HEIGHT="100%" id="objectID" ALIGN="CENTER">
<PARAM NAME=movie VALUE="myMovie.swf">
<EMBED id="EMBEDID" src="myMovie.swf"
bgcolor=#000000 WIDTH="800" HEIGHT="600" NAME="tagname" ALIGN="top"
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
</EMBED>
</OBJECT>


Now to resize you have do like below in your javascript

<script language="javascript">

function resizeMovie(){


// for IE
document.objectID.width = newWidth
document.objectID.height = newHeight

// For netscape
document.EMBEDID.width = newWidth
document.EMBEDID.height = newHeight

}
}

</script>

Where function resizeMovie is your customised function you would call when you
want to ewsize the movie.

Hope this helps

Good Luck

Hemendra Singh Shaktawat

Mindfire Solutions
www.mindfiresolutions.com

AddThis Social Bookmark Button