This content has been marked as final. Show 4 replies
You are creating a new, empty movieClip. Then you load in an external .swf into that clip. You have a typo in the line: munRamme._y = 0;, but that won't matter in this instance, because, if you don't specify an x and y position for the new movieClip, it will be positioned at point 0,0, the upper left corner of the stage. Since you are using AS2, the property names are _width and _height for the clip's width and height properties. The way that you have this written, you are creating two new properties for the movieClip. That's perfectly legal, but not at all what you want.
When you import an external .swf, it will import at its original size. If you don't want to change the size, then don't specify a _width or _height value. So, if you want to import this .swf, keep it at its original size and position it in the upper left corner, then leave out everything after the loadMovie() call.
Thanks for your answers, I haven't been here for a week, and haven't had the time to look into the problem. But we do need to change the size of the swf files we load since they are all to be shown in the same window, and originally they have different sizes.
Do we need a preloader here, or can we get around the problem with some simple commands?
Well you have several problems. First is just a stylistic question. You create an empty moveie called "clip" and assign its reference to a variable called "minRamme." That is a perfectly legit thing to do, but I wonder why. Generally I use the variable as a sort of shorthand or short cut to refer to the clip -- something easier to type without mistakes. In this case you are making it more difficult. So personally I would change those around, but that is for you to decide.
The next is also a stylistic thing. You are creating the clip at a depth of zero. Again a perfectly legit depth. However you have more than a million depths to pick from, and who knows, next week you might want something to be under minRamme so I would encourage you to at least move it up to 10.
Okay now on to the three problems that are left. (I think you only know about one at this point!).
When you use loadMovie there is a pause between the time the request is made and the time the movie actually loads.It can be quite quick (but still not zero) if you are testing locally on your machine or quite long over a dial up internet connection. And it won't always be the same so you can't guess exactly what it will be. So when you try and set the width and the height they aren't avaialbe for setting.
One problem is that you are mixing your AS3 and AS2 code. Under AS2 -- which is where you will have createEmptyMovieClip() -- the properties are _width and _height. The underscores are dropped in AS3.
So you need some technique to check to make sure your movie is loaded before you try and set its _width and _height. You could start an onEnterFrame or setInterval that polls the loading clip to see how many bytesLoaded vs bytesTotal. This is what is known as an old-school preloader. Or you could use the MovieClipLoader class. It has a nice onLoadInit event that will tell you when the clip is ready. Check it out in the help files and post back if you want to go that way.
But even then you are going to have another problem. The published stage size settings are not part of the information available to you when you load an external swf. You mentioned that orginally they had different sizes. So when they load you won't know what sizes to set the external files to. It all depends upon how they are laid out and what the content on the first frame is like.