PDA

View Full Version : scaling problem


franko
03-28-2001, 05:38 AM
I have been trying to scale a vector graphic which is a map.

I have the graphic in a mc called "map" it is just on one frame.

In the main scene, I have the movie clip in one layer and in a second layer I have a button which has the script

on (release) {
setProperty ("map", _xscale, getProperty("map", _xscale)+50);
setProperty ("map", _yscale, getProperty("map", _yscale)+50);
}


But nothing happens when the button is clicked. I would thing the x and y scale propterties would be increased by 50%.

any help would be appreciated.

Jesse
03-28-2001, 11:34 AM
Perhaps your paths are not quite correct... if the button isn't on the main stage this code iwllc ause problems so you're better off giving literal paths:

setProperty ("_root.map", _xscale, getProperty("_root.map", _xscale)+50);

you can also type it shorthand like this:

_root.map._xscale += 50;
_root.map._yscale += 50;

Saves a lot of typing huh? :)
Flash 5 supports the '+=' and '-=' operators, which take a variable and add (or subtract) the number after the operator.

So if I have avariable 'count' whihc is equal to 3.
count += 1;
will make count = 4, and
count -= 1;
will make count = 2...

Cheers

Jesse

franko
03-28-2001, 04:47 PM
thanks for your help on the short notation.

the problem was not one of paths. It was all in _root. But I was using the object name and had not assigned an instance name. Once I did that any of the variations of the code worked.