Skip navigation
Currently Being Moderated

Possible to Have a TextField Visible ONLY in a Specific Location/Coordinates?

Sep 13, 2013 2:34 PM

Hello All,

 

Using: Adobe Flash Professional CS6, and Actionscript 3.

 

I have a scrolling TextField that scrolls across the bottom of the screen. The TextField is inside a Layer that stretches across the entire Timeline so it's visible on all Frames.

 

So for example, lets say the TextField is 100 pixels high. and currently it scrolls from the far right side (Starting from OFF the screen from right to left), i.e. when the Message begins scrolling at the very first instance it starts you cannot see any part of the TextField because it is off the screen all the way to the right... If that makes sense? But what I want to do is try to hide Message for about the first 50 pixels until it passes a specific point on the screen.

 

This might be easier if I can make a Graphical representation:

I also attached a SIMPLE drawing of what I'm trying to achieve...

                                        Frame_and_TextField.jpg

 

 

     Frame:  1650x1080

______________________________

|                                                                               |

|                                                                               |
|                                                                               |

|                                                                               |

|                                                                               |

|                                                                               |         *this below is where the msg begins scrolling... (The tilde "~" represents the TextField)

|-------------------------------------------------| |~~~~~~~~~~~~~~~~~~~~~~~|

|_____Display_Msg_Here____|__XX__|  |~~~~~~~~~~~~~~~~~~~~~~~|

 

Ok, so inside the "Frame" above you see a dotted line near the bottom but before the bottom border of the Frame, which is the solid lines. Now from that line to the bottom Frame is where I display the Scrolling Message (*where it says "Display Msg Here"). And where you see the 2 red "X" this is where I want the Msg to be hidden as it passes through.

 

Eventually where the 2 red "X"s are I want to put a TextField that will Always display the Current Date and Time, so maybe if there is a way to put both of those textFields in the same "Layer" and have the Field with the date and time be in front of the other. But if I do that wouldn't I still see the Scrolling message as it passes under the Date and Time one?

 

If you need a better explaination just let me know and I'll see if I can clear things up a bit. But hopefully the image I attached does a better job then what I was trying to say myself...

 

 

Any thoughts or suggestions would be greatly appreciated.

 

BTW: The Scrolling message is ONLY a single line, so what you see in the attached image is NOT how the TextField would actually look...

 

 

FYI:  I'm still fairly new with Flash and AS3.

 

Thanks in Advance,

Matt

 
Replies
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 13, 2013 3:28 PM   in reply to mrm5102

    if you're using timeline tweening add a keyframe where you want the textfield to become visible.  on that keyframe assign its alpha to 1 and on the keyframe where the textfield starts is x tween from off-stage, assign its alpha to 0.  make sure the font is embedded.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 16, 2013 7:50 AM   in reply to mrm5102

    how are you scrolling your text?  ie, how does it move from right to left?

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 16, 2013 10:35 AM   in reply to mrm5102

    use:

     

     

    var visibleX:int = stage.stageWidth-100; // <- assign this value to meet your needs

     

    function scroll_ticker(myevent:Event):void

    {

        //Move the Ticker 'n' pixels to the left on the X-Axis:

        MyMovie.Ticker_TextField.x-=ticker_speed;

     

        //If the Ticker's X-Coordinate is <= the Negative Ticker-Width, then reset it's X-Coordinate

        //to the starting point (*i.e. stage.stageWidth)...

        if(MyMovie.Ticker_TextField.x <= (0 - ticker_width))

        {

            MyMovie.Ticker_TextField.x = stage.stageWidth;

        }

    if(MyMovie.Ticker_TextField.x <= visibleX)

        {

            MyMovie.Ticker_TextField.visible=true;

        } else {

    MyMovie.Ticker_TextField.visible = false;

    }


    }

     

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 16, 2013 11:12 AM   in reply to mrm5102

    you're welcome.

     

    p.s. please mark correct/helpful responses.

     
    |
    Mark as:
  • kglad
    72,212 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 16, 2013 1:11 PM   in reply to mrm5102

    don't use a tlftextfield and change your code to:

     

    var visibleX:int;

    MyMovie.Ticker_TextField.multiline=false;

    MyMovie.Ticker_TextField.autoSize="left";

     

    function scroll_ticker(myevent:Event):void

    {

    visibleX= -MyMovie.Ticker_TextField.width+datetimesquare.x;

        //Move the Ticker 'n' pixels to the left on the X-Axis:

        MyMovie.Ticker_TextField.x-=ticker_speed;

     

        //If the Ticker's X-Coordinate is <= the Negative Ticker-Width, then reset it's X-Coordinate

        //to the starting point (*i.e. stage.stageWidth)...

        if(MyMovie.Ticker_TextField.x <= (0 - ticker_width))

        {

            MyMovie.Ticker_TextField.x = stage.stageWidth;

        }

    if(MyMovie.Ticker_TextField.x <= visibleX)

        {

            MyMovie.Ticker_TextField.visible=true;

        } else {

    MyMovie.Ticker_TextField.visible = false;

    }


    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points