PDA

View Full Version : resizing movie clips with AS



Binji
October 22nd, 2006, 11:37 AM
I want to create a movie clip of custom size so i tried doing it with this code:


_root.createEmptyMovieClip("nar_vrata", 1);
var zac_X:Number = 265-sirina/2;
var kon_X:Number = 265+sirina/2;
nar_vrata.attachMovie("vrata", "vrata_mc", this.getNextHighestDepth());
nar_vrata.vrata_mc._height = visina;
nar_vrata.vrata_mc._width = sirina;
nar_vrata.vrata_mc._x = zac_X;
nar_vrata.vrata_mc._y = 480;

but nothing happens! What am i doing wrong?

rhamej
October 22nd, 2006, 03:59 PM
Where are the vars sirina and visina defined?

Binji
October 22nd, 2006, 05:15 PM
They are defined in _root but they are ok..i already tried that. I have no idea why it doesnt work:d:

Binji
October 22nd, 2006, 05:19 PM
Ermmm....the symbol vrata wasnt exported for actionscript...:cyclops: Works now:pope:

rhamej
October 22nd, 2006, 05:21 PM
doh! Gald you figured it out =)

Binji
October 22nd, 2006, 08:19 PM
Basic mistakes are most difficult to detect i guess :)

I do have another question concerning AS..too trivial to deserve its own topic i think:
I have defined a function which returns a string

function stanjeMP():String{}

and i tried to concatenate it with another string like this:


var text:String = "bla bla"+stanjeMP;

but instead of the returned string it says: bla bla[type Function]
How do i make it to simply give me the string i want?

rhamej
October 22nd, 2006, 11:20 PM
Whats inside the stanjeMP function?

rhamej
October 22nd, 2006, 11:28 PM
This works. But it's hard to tell without knowing whats inside your function


function stanjeMP():String {
blah = "blah blah";
return blah;
}
var text:String = "bla bla"+stanjeMP();
trace(text);