A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Script exported for flash 6 doesnt work if exported to 8

  1. #1
    Member
    Join Date
    Mar 2006
    Posts
    48

    Script exported for flash 6 doesnt work if exported to 8

    This code works perfect if exported or published for flash player 6, if placed into a 8 publish document,doesnt work. This is rotating menu
    PHP Code:
    onClipEvent (load) {
    hx 390/2;
    hy 325/2;
    100;
    30;
    r2 50;
    function 
    speed(num) {
    speedX = -(_root._xmouse-hx)/num;
    return 
    speedX;
    }
    function 
    trans() {
    += speed(100);
    range = ((p+180)*Math.PI)/180;
    re1 = ((Math.sin(range))*r);
    re2 = ((Math.cos(range))*a);
    re3 = ((Math.cos(range))*r2);
    }

    function 
    property() {
    trans();
    _x hx+re1;
    _y hy+re3;
    _xscale _yscale=_alpha=re2+70;
    this.swapDepths(_alpha);
    }
    }
    onClipEvent (enterFrame) {
    property();


  2. #2
    Senior Member
    Join Date
    Nov 2005
    Location
    dante's inferno
    Posts
    904
    I published to 8 and 9, did not get any errors.

    You do have this code on a movieclip, correct?


    IMS

  3. #3
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Variables 'p' and 'speedX' need to be initialized.
    Code:
    onClipEvent (load) {
    	hx = 390 / 2;
    	hy = 325 / 2;
    	r = 100;
    	a = 30;
    	r2 = 50;
    	p = 0;
    	speedX = 0;
    	function speed(num) {
    		speedX = -(_root._xmouse - hx) / num;
    		return speedX;
    	}
    	function trans() {
    		p += speed(100);
    		range = ((p + 180) * Math.PI) / 180;
    		re1 = ((Math.sin(range)) * r);
    		re2 = ((Math.cos(range)) * a);
    		re3 = ((Math.cos(range)) * r2);
    	}
    	function property() {
    		trans();
    		_x = hx + re1;
    		_y = hy + re3;
    		_xscale = _yscale = _alpha = re2 + 70;
    		this.swapDepths(_alpha);
    	}
    }
    onClipEvent (enterFrame) {
    	property();
    }

  4. #4
    Member
    Join Date
    Mar 2006
    Posts
    48
    thank u.. it worked. Question: This rotating menu is on the frame 1 in the main timeline. If I tell a button to go to frame 5 after release, the rotating menu shows on top of the frame 5 even though is a empty frame on its place...

    how can I tell the menu to stay only in frame 1 and dont move?

  5. #5
    :
    Join Date
    Dec 2002
    Posts
    3,518
    The reason they still remain is that the swapDepths function makes the depths a positive number. So they need to be removed with the 'removeMovieClip' function.
    Code:
    onClipEvent (load) {
    	hx = 390 / 2;
    	hy = 325 / 2;
    	r = 100;
    	a = 30;
    	r2 = 50;
    	p = 0;
    	speedX = 0;
    	function speed(num) {
    		speedX = -(_root._xmouse - hx) / num;
    		return speedX;
    	}
    	function trans() {
    		p += speed(100);
    		range = ((p + 180) * Math.PI) / 180;
    		re1 = ((Math.sin(range)) * r);
    		re2 = ((Math.cos(range)) * a);
    		re3 = ((Math.cos(range)) * r2);
    	}
    	function props() {
    		trans();
    		_x = hx + re1;
    		_y = hy + re3;
    		_xscale = _yscale = _alpha = re2 + 70;
    		this.swapDepths(_alpha);
    	}
    	this.onPress = function() {
    		trace(this)
    		this._parent.gotoAndStop(5);
    		//replace 'instance1', 'instance2' etc with actual instance names of clips
    		this._parent.instance1.removeMovieClip();
    		this._parent.instance3.removeMovieClip();
    		this._parent.instance4.removeMovieClip();
    		this.removeMovieClip();
    	};
    }
    onClipEvent (enterFrame) {
    	props();
    }
    Last edited by dawsonk; 10-01-2008 at 01:52 PM.

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