I am VERY new to actionscripting and have got myself into a bit of a muddle. I am trying to import a jpeg image into an empty movie clip and then resize the image. I can scale it, and position it but I can’t resize it.
Somebody suggested creating a movieclip in Flash first and giving it an instance name. Then use loadMovie to place the jpeg into that movieclip. This did work and allowed me to resize it but only the movieclip would be resized which in turn resized the image proportionally. I still couldn’t specify exact dimensions of the image - only the movieclip. I hope this makes sense… I think I’ve lost myself!!
Thanks for the reply. However I’m still having problems. There seems to be a problem with the IF statement. It never returns true. Should there be some sort of loop to test how much of the movieclip has loaded?
I always have trouble testing getBytesTotal against getBytesLoaded with jpeg loads as well, so in Scotty’s code, I would just leave out the t==l. Since the width and height aren’t set till it is loaded anyway, their checks should be sufficient. Try
if (t == l && t != 0 && cab._width>0 && cab._height>0) {
Just registered in this Forum to give you an answer to your problem. This annoying Flash bug has been torturing me for weeks now and your post has been the only sign someone else encountered the same problem.
Although you might think that something as simple as loading a .jpg or another .swf into an empty symbol and then resize it via _height and _width and afterwards change the position via _x and _y, should be widely known if it wouldn’t work.
The work around by using _xscale and _yscale instead of _height and _width is only a small solution that works fine when the movie runs in an IE 6.0, but still Opera and Firefox will make the image “vanish” from the stage from time to time.
Actually the image does show, but is placed on the side of the stage, sometimes even rotated by 90° clockwise, which i think is especially weird.
To get this fixed :
* Create an empty symbol in the library. (Let's say you call it "OuterEmpty")
* Duplicate the symbol in the library. (Let's say you call the duplicate "InnerPic")
* Drop an instance of "InnerPic" at position x:0, y:0 into the symbol "OuterEmpty"
* Now the symbol "OuterEmpty" and every future instance of it contains the "InnerPic"-symbol
* Import the .jpg or .swf via ActionScript : loadMovie("mypicture.swf", _root.OuterEmpty.InnerPic)
* Use a "this.onEnterFrame = function() {" to resize and reposition the empty symbol !!!
* Now you can use the "setProperty(_root.OuterEmpty, _width, 123);" ,same with _height, _x and _y.
BUT YOU ONLY RESIZE AND REPLACE THE **OUTER** EMPTY FRAME, not the InnerPic !!!
The whole code should look like this :
function ImportResizeChangePosition(){
loadMovie("myPicture.swf", _root.OuterEmpty.InnerPic);
this.onEnterFrame = function() {
setProperty(_root.OuterEmpty, _width, 123);
setProperty(_root.OuterEmpty, _height, 456);
setProperty(_root.OuterEmpty, _x, 78);
setProperty(_root.OuterEmpty, _y, 90);
}
}
I described this problem so detailed, to make others find this forum-post when searching via google using the keywords that did not help me find an answer.
Let me know if it worked out for you.
Good luck.
Frank
… you sure have to give the instances of the empty symbols instance-names, of course. I used the same names that i’ve given the symbols in the library.
So on the stage you have an instance of the symbol “OuterEmpty”, that you give the instance-name “OuterEmpty” and inside of that is an instance of the symbol “InnerPic” that you give the instance-name “InnerPic”.