A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] easy:if(mc._xscale<50){//do smthng} if not: problem...

Threaded View

  1. #1
    user in A minor
    Join Date
    Jan 2005
    Location
    finland
    Posts
    121

    [F8] easy:if(mc._xscale<50){//do smthng} if not: problem...

    hi. can someone please tell me why this is not working. this should be easy for anyone who actually knows a bit about anything ...

    i'm trying to make an mc 'pic' grow if clicked, attach a text box to it, and on a second click make it shrink again and unattach the text box. i've tried testing the mc's size with if-statements like so:

    Code:
    if (pic._xscale <= 50) {
    	pic.onRelease = function() {
    		myTween = new mx.transitions.Tween(pic, "_xscale", easeType, 50, 100, 7);
    		myTween = new mx.transitions.Tween(pic, "_yscale", easeType, 50, 100, 7);
    		attachMovie("textbox", "textbox", 100, {_x:300, _y:10});
    	};
    }
    if (pic._xscale ==100) {
    	pic.onRelease = function() {
    		myTween = new mx.transitions.Tween(pic, "_xscale", easeType, 100, 50, 7);
    		myTween = new mx.transitions.Tween(pic, "_yscale", easeType, 100, 50, 7);
    		unloadMovie("textbox");
    	};
    }
    i've tried many variations of this code. sometimes i get the first if-statement to work, sometimes the second, but never both of them. this code does grow the 'pic' and attach the text box, but ignores the second if-statement. i've attached an example fla.

    your help will be very much appreciated!
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center