11 Replies Latest reply: Sep 17, 2013 7:56 AM by mrm5102 RSS

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

    mrm5102 Community Member

      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

        • 1. Re: Possible to Have a TextField Visible ONLY in a Specific Location/Coordinates?
          kglad CommunityMVP

          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.

          • 2. Re: Possible to Have a TextField Visible ONLY in a Specific Location/Coordinates?
            mrm5102 Community Member

            Hey kglad, thanks for the reply!

             

            Sorry still new to the Adobe Flash CSx suites and haven't really attempted anything in the way of "tweening". My program is just a basic "Wallboard" type program where each "Frame/Screen" just displays some data, and I added a Scrolling Ticker message to it as well...

             

            Ok so if I'm not exactly using tweening to accomplish this, could I do something like this? Or maybe this is even what you were telling me to do... Could I just create a new "Keyframe" and size it to however big the section is where I want the ticker to be hidden as it passes through, and set the alpha to 1 like you said, and align/size the frame to fit in that area?

             

            Thanks again kglad for the reply, much apprecited!

             

            Thanks,

            Matt

            • 3. Re: Possible to Have a TextField Visible ONLY in a Specific Location/Coordinates?
              kglad CommunityMVP

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

              • 4. Re: Possible to Have a TextField Visible ONLY in a Specific Location/Coordinates?
                mrm5102 Community Member

                Hey, thanks for the quick reply!

                 

                I'm using this code below to "step" the textfiled forward (i.e. Right to Left) 'X' pixels a seconds. I allowed for the speed of the TextField to be dynamic by including the ability for a user to send an integer to the Wallboard and allow that to be used as the speed. And things seem to be working pretty well.

                 

                Here's my Function which moves the Textfield:

                 

                     *Basically it moves the TextField 'n' pixels to the left on each execution of this function, and if the Ticker's X-Coordinate is less then or equal to the Negative width of the Ticker, then reset the TextFields 'X-Coordinate' to the width of the Stage. So if the TextField is 1000 pixels wide, once the X coordinate is equal to -1000 reset X to the stageWidth... Hope that makes sense...

                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;

                    }

                }

                 

                 

                Thanks Againfor the reply!

                 

                 

                Thanks,

                Matt

                • 5. Re: Possible to Have a TextField Visible ONLY in a Specific Location/Coordinates?
                  kglad CommunityMVP

                  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;

                  }


                  }

                   

                  • 6. Re: Possible to Have a TextField Visible ONLY in a Specific Location/Coordinates?
                    mrm5102 Community Member

                    Hey kglad, thanks again for the reply!

                     

                    Ok cool, I'll give that a try shortly and let you know what happens.

                     

                    Thanks again for the quick reply!

                     

                     

                    Thanks,

                    Matt

                    • 7. Re: Possible to Have a TextField Visible ONLY in a Specific Location/Coordinates?
                      kglad CommunityMVP

                      you're welcome.

                       

                      p.s. please mark correct/helpful responses.

                      • 8. Re: Possible to Have a TextField Visible ONLY in a Specific Location/Coordinates?
                        mrm5102 Community Member

                        Ok so.. I added that variable and the if/else statement and a few traces to see what it was doing, and I think since I have this line in a couple places in the AS3 Code,  "Ticker_TextField.visible = true/false" it doesn't seem to be hiding the Ticker when it reaches that point. I could see traces in each of the if and the else that the stuff in those were getting executed but watching the movie showed that nothing was being hidden.

                         

                        Basically XML Data is being sent to the movie via an XML Socket and each time new data is sent for each frame, which is about every 5 seconds or so, I am also checking if the Current Time (*in seconds) falls within the timespan of the  "Start" and "End" times (*also in seconds/Epoch) which have been set for the Ticker. into global variables

                         

                        So for example lets say there are 6 Frames, then that means every five seconds data is being sent for one of those 6 Frames sequentially, which also controls when and what Frame to display, and at the end of the "iteration" through the movie (*i.e. after the 6th Frame) the same XML Socket receives the Ticker Data. The Ticker data contains a Start and End time, the message string in which to display and a few other things like Text Color and stuff like that...

                         

                        Since the Ticker's Message could technically be any length I'm not sure if just hiding (i.e. setting visible to false) would accomplish what I'm attempting...? Because if the message string is longer then 100 pixels, then once we set the visiblility back to "True" after it's <= visibleX it will again be showing behind that small section since it's longer then 100 px... Does that sound correct?

                         

                         

                         

                        So what I just tried now was, I created a new Layer in the Timeline and made it the very top Layer which contains a single Keyframe that stretches the length of the Movie (*i.e. in Frames). I then inserted a TLF Textfield in that square where I want to hide the message as it passes under from the example image I posted in the OP. I added some temproray Text (*i.e. an example date and time) to the TextField, set the Alpha to 100% and gave it a background color. And it seems to be doing what I want...

                         

                        I attached a screenshot of what it looks like with the Text "passing under" the square with the Date and Time... Hopefully that will exaplain it a little better then I could.

                        Sample_Ticker_Msg.jpg

                         

                        Thanks Again,

                        Matt

                        • 9. Re: Possible to Have a TextField Visible ONLY in a Specific Location/Coordinates?
                          kglad CommunityMVP

                          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;

                          }


                          }

                          • 10. Re: Possible to Have a TextField Visible ONLY in a Specific Location/Coordinates?
                            mrm5102 Community Member

                            Hey kglad, thanks again for the reply!

                             

                            Sorry got your reply on my drive home yesterday so couldn't really give it a try till I got back in the office this morning.

                             

                            Ok, I'll give that a shot now. Does it matter that the Date and Time box is TLF or does that have to be classic as well? Also, will I still be able to use the filters and stuff like that if I change the Ticker to "Classic" Text?

                             

                             

                            Thanks,

                            Matt

                            • 11. Re: Possible to Have a TextField Visible ONLY in a Specific Location/Coordinates?
                              mrm5102 Community Member

                              Hey kglad,

                               

                              Humm... It seems to be appearing after the Ticker_TextField has totally passed the datetimesquare, instead of starting to display after the first character in the messgae passes the datetimesquare.

                              *For example, if the Text is "This is a sample Ticker Message", the Text is not visible until the word "Message" has completely passed the datetimesquare, instead of starting to display after the "T" in "This" (*the first character in the Ticker's String) passes the datetimesquare.

                               

                              Maybe my best bet would be to keep it like it was and just have the datetimesquare block the Ticker as it goes under it just like in the photo I attached 2 replies ago. Because thinking about it, it seems too difficult or maybe not even possible to have only part of a TextField begin to display (*i.e. be visible), then to just hide it behind the DateTimeSquare TextField?

                               

                              Anyway, thanks again for the reply, much appreciated!

                               

                               

                              Thanks Again,

                              Matt