Textboxes on stage eventually disappearing - AS3 - actionscript-3

I'm making a digital clock with 7 stripes on 6 numbers.
I replaced the stripes with textboxes filled with 'I''s. So im letting them disappearing on each time with the code: textbox.text = ""
I did all the coding, but the textboxes on screen will eventually disappear?
Thanks in advance.

Related

Stopping my controlled object going off the screen in pygame

i have started making a game in pygame using python 3.2.2
i have a title screen that has a new game button that when pressed a space background appears with a UFO you can control with the arrow keys
but my UFO can go off the screen in every direction,i want to make it stop on the border of the screen. and i want it to do this on every future screen that will appear later in the game.
i have no idea of the principles to do this...and where it should sit in the code. i read something about rectangles. do i need to define a rectangle then get the ufo to detect this rectangle and stop when it detects the rectangle
any help appreciated
im pretty good at working stuff out,so a push in the right direction would be appreciated.
thanks
What you need is collision detection. Here is some sample AABB collision detection code in python:
def collide(A_top, A_bot, A_left, A_right, B_top, B_bot, B_left, B_right):
if B_left < A_right and B_top < A_bot and B_right > A_left and B_bot > A_top:
return True #IS colliding
return False #IS NOT colliding
Now just collide with the borders of the screen, or anything else that happens to be on the screen.
OTHER SOLUTION:
Just check like this:
if ufo.x < 0 or ufo.y < 0 or ufo.x + ufo.width > screen.width or ufo.y + ufo.height > screen.height:
#Do collide code

How to let an object appear in actionscript

I have an animation that may stop at 2 points depending on what the user fills in, if the animation stops at one of the two frames an objects has to apear and have to disappear if the user continues with playing the animation again. Can someone tell me how I can let object appear if the animation stops at a certain frame?
Do I need something like this? I have very little experience so please help!
star_mc._alpha = 0; star_mc.onEnterFrame = function(){ if(this._alpha < 100){ this._alpha = this._alpha + 5; }}
The code looks ok.... try it... just put it in the right place!
It's hard to tell where because I don't know how your animation built!!

Controlling character movement, and keeping score while doing so, AS3

I have created a game where you have to follow the suggested arrow (going from right to left) to control the movement of the character. As you go trace the arrow from right to left, the characters position changes and he rubs his forehead. I wanted it to be very interactive, so you feel like you are controlling the character. As he rub his forehead, I want the "heat meter" to increase, and after it reaches hot, the level is completed. Is this even possible with Actionscript 3? Thank you in advance for letting me know, and if it is, how would I go about setting this up. I am very new to AS3. :/
Use gotoAndStop() to navigate to the head scratching menu using if statements (if(var thinking:Boolean == true) and to the heat meter: if(character.currentFrame == "scratchinghead") { var heatmeter:int ++; }
Then to win: if(heatmeter > 99) { gotoAndStop("win"); }
To check if the mouse is hovering, use MOUSE_ROLL_OVER.

AS3 Slider Component built in focus rectangle never show again if slider is used once

unlike most people that want to completely disable the blue focus rectangle of the different components specially the slider, i want it to be there when focused, the focus rectangle show properly when focusing on the slider programmatically with this code :
my_mc_1.addEventListener(MouseEvent.MOUSE_OVER, Focus_My_Slider_1);
function Focus_My_Slider_1 (event:MouseEvent):void {
stage.focus = My_Slider_1
}
my_mc_2.addEventListener(MouseEvent.MOUSE_OVER, Focus_My_Slider_2);
function Focus_My_Slider_2 (event:MouseEvent):void {
stage.focus = My_Slider_2
}
once you run the program, it works great, unless you use any of the sliders and the blue border is gone, it is gone forever however the sliders are focused but the blue border no more show up unless you press tab key, it bring it back to live.
i tried a lot to find a solution but no luck, and this is my first post here.
hope any one can help.

XY restrictions for custom mouse cursor in Actionscript3

I have this interactive 5 seconds animated intro for a website. the preloader and one item are animating and i made the second animation follow the mouse cursor but it has to stay within a certain part of the stage to work with the other animation happening on screen.
I have this code on the movie clip
Mouse.hide();
potistiri.addEventListener(Event.ENTER_FRAME, newCursor);
function newCursor(event:Event): void { potistiri.x = mouseX;
potistiri.y = mouseY; }
and i like i said i just want it to stay in the area i want...
i found this code which gives me errors for not putting the staments if and else if correctly or that it needs a rightparen when i input my numbers in...
if(this._x>Stage.width){
this._x=Stage.width;
}else if(this._x<0){
this._x=0; }
but i cant get it to work...
i need it to move between x 208-656 and y 140-336 and when it gets out of that area the object stay there doing its loop and you see the normal mouse cursor moving in the rest of the screen.
thanks a lot in advance...im leaving my it to the experts in here to pls help me ouy!
The logic you're using in your if/else is fine for clamping the movie clip to a specific area, what exactly do your errors say?
In regards to seeing the normal mouse cursor again you could try using the same if/else checks to determine whether the mouse should or should not be hidden ie if the mouse is outside the area and is hidden, call Mouse.show(), else if it is inside the area and shown, call Mouse.hide().