A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: output textfield

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    6

    output textfield

    I'm trying to display on the screen the value of a variable during the swf reproduction. I do not need a function like "trace", because I would to view the variable value on the swf player. I know that this can be made by textfield, but after a lot of trials I have zero results. Can anyone explain me the procedure? Here the code, I've to display the value of click_point variable. Thanks.

    Code:
    onClipEvent(load){
        secondTime = 2560;
        _global.startTime = getTimer();
        mouse_pressed = false;
    	_global.random_num = (Math.random()*1001)+1500; //genera numero tra 1500 e 2500
    	_global.count = 0;
    }
    
    onClipEvent(mouseDown){
    	_global.click_point = getTimer()-_global.startTime //memorizza il punto al quale si è premuto il mouse
    
    	if (_global.click_point < 5120){
    		mouse_pressed = false;
    		count = 0;
    	}else {	
    			mouse_pressed = true;
    			count = count + 1;			
    		   }
    }
    
    onClipEvent(enterFrame){
        if(getTimer()-_global.startTime>=2560 && mouse_pressed == false && count == 0){
            elapsed = (getTimer() - _global.startTime) % secondTime;
            this._rotation = 360 * (elapsed/secondTime);
        }
    	else {
        if(getTimer()-_global.startTime>=2560 && count >= 1){
            _global.time2 = (getTimer()-_global.startTime)-_global.click_point; //inizio count down
            if(_global.time2 < random_num){
                elapsed = (getTimer() - _global.startTime) % secondTime;
                this._rotation = 360 * (elapsed/secondTime);
    		} else {
    			elapsed = 0;
    			secondTime = 0;
    		}
    	}
    	}
    }

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Use Text Tool (T), open Properties Panel, and change from Static Text to Dynamic Text, and then draw a textfield on stage. Click on the textfield, open Properties Panel again, and in the Instance textfield, give it an instance name of txt. Then, add this line of code in your onClipEvent(enterFrame) part:

    Actionscript Code:
    _root.txt.text = _global.click_point;

    Hope it helps
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #3
    Junior Member
    Join Date
    Oct 2011
    Posts
    6
    Obviously it works now.

    Nig, my savior...

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