PDA

View Full Version : actionscript/flash won't display full res of image


fslick
11-22-2006, 02:18 AM
Hello all,

Okay so I have this flash "app" that parses xml data and visualizes it appropriately. One of the xml tags it parses is the name of an image, that gets updated every 2000 milliseconds or so.

As for my problem, I cannot get the image to be displayed at its full resolution (a "current" or "second" image in the frame), or any image for that matter -- it probably shows them all at something like < 300 x 150 pixels. I was hoping that someone could shed some light on this subject or point me in the right direction.

Here's a snipit of the important code:

//new function that gets the xml object/string passed in
function updateImage (newFile:String)
{

// Hide the "current" frame, and load the picture into it.
currentPic_mc._alpha = 0;
currentPic_mc.loadMovie (newFile);

//trying to force it to display the images at a different size -- doesn't work
currentPic_mc._xscale = currentPic_mc._yscale = 30;

//finally 2 built in flash calls that ease the images in and out
new mx.transitions.Tween( blah blah etc )

}

If anyone needs any more info to decipher my question, I'd be happy to reply. Thanks again for reading!

-fslick

Hoogs
11-22-2006, 03:27 AM
Can't solve your whole problem but I can point out a few things I've noticed:
Firstly, if your problem is that the image is not big enough, trying to resize it to 30% of the original scale wont help.

Secondly, in order for the resize to work it has to occur once the image is loaded, not at the time the loadMovie is called.

Try...
onClipEvent (data) {
_xscale = _yscale=30;
}
...or a frame equivelent if you prefer.

You could take this further with something like...
onClipEvent (data) {
_xscale = _yscale=30;
_alpha = 0;
_root.fadeFunction();
}...as again, you dont want the fade happening at the time of the loadMovie call (note: this is of course assuming there is a function on the root timeline called fadeFunction)

The other thing to consider is have you physically rescaled the movie clip on the stage? This of course wont make a difference if you get the above code working, but could explain why you've been having these scale problems.

fslick
11-27-2006, 08:44 PM
Thanks for the reply. No matter where I add the function you posted (+the change for what data gets passed, natually) I get the following error:

**Error** Scene=Scene 1, layer=Code, frame=1:Line 357: Clip events are permitted only for movie clip instances
onClipEvent (newFile)

Any help would be awesome, thanks.

tg
11-27-2006, 10:10 PM
look at this tutorial... should take you where you want to go:

http://www.actionscript.org/resources/articles/3/1/MovieClipLoaders-Part-1/Page1.html

also look at this on. it may help also:
http://www.actionscript.org/resources/articles/218/1/Using-loadMovie----Understanding-Scale/Page1.html

i have used neils method with success. you may be able to set your scale in the onLoadInit function.

fslick
12-16-2006, 08:18 AM
thanks for the replies guys -- got my problem fixed.