14 Replies Latest reply: Nov 27, 2013 7:21 AM by kglad RSS

    Is it possible to load a URL on stage?

    EGBAR.Mary Community Member

      Hi,

       

      I'm using Flash CC-Action Script 3, is it possible to load a URL onto the stage?

        • 1. Re: Is it possible to load a URL on stage?
          kglad CommunityMVP

          not unless you're publishing an air app.

          • 2. Re: Is it possible to load a URL on stage?
            EGBAR.Mary Community Member

            Hi,

             

            I'm making a "Welcome Kiosk" for our company lobby and will be using a touch

            screen monitor for visitors to go. They can either go to The Phone

            Directory, Go To our Web page, or view Our Videos. So I can't display our

            webpage in a container on the stage?

             

            With warmest regards,

             

            Mary Crotteau

            Graphic Design Specialist

            Sunshine Makers, Inc./Simple Green

            • 3. Re: Is it possible to load a URL on stage?
              kglad CommunityMVP

              for a kiosk you should be using a desktop air app.  you can therefore use the HTMLLoader class to load a url into your app.

              • 4. Re: Is it possible to load a URL on stage?
                EGBAR.Mary Community Member

                Thank you.

                 

                I'll check out lynda.com <http://lynda.com>  for help. So on our flat screen

                monitor, Air should be able to function like a huge ipad and pull in Video,

                A Phone list, and display our website within the stage?

                 

                Could you tell me, is HTML5 better for something like this or is Action

                Script 3 better?

                 

                With warmest regards,

                 

                Mary Crotteau

                Graphic Design Specialist

                Sunshine Makers, Inc./Simple Green

                • 5. Re: Is it possible to load a URL on stage?
                  kglad CommunityMVP

                  actionscript/flash is easier (unless you're much more comfortable with javascript/html/ajax or jquery) as long as your kiosk runs an os that supports adobe air.

                  • 6. Re: Is it possible to load a URL on stage?
                    EGBAR.Mary Community Member

                    Thanks. I think our IT department will handle it since they do html/java/and

                    all that stuff except for action script/flash. I am a little desperate

                    though. I need to have this at least display a working clock for know and

                    the phone list, which will display fine once I get to it. Can you be so kind

                    and look at my horrible action script and help me get the clock to work

                    continuously and show minutes under 10 with a "0"?  I just need to have

                    something to show for our Annual Management meeting.

                     

                    Thank you sincerely for your time.

                    Code:

                    import flash.events.MouseEvent;

                    import flash.text.TextField;

                    import flash.text.Font;

                    import flash.text.TextFormat;

                    import flash.display.Sprite;

                    import flash.text.*;

                    import flash.filters.BitmapFilter;

                    import flash.filters.BitmapFilterQuality;

                    import flash.filters.BlurFilter;

                    import flash.display.Bitmap;

                    import flash.display.Loader;

                    import flash.net.URLRequest;

                     

                    var link:URLRequest = new URLRequest("http://simplegreen.com/");

                     

                    //ADD CONTAINERS

                    var containerStage:Sprite = new Sprite();

                    containerStage.tabChildren = false;

                    stage.addChild (containerStage);

                     

                    //DATE TIMER

                    var my_date:Date = new Date();

                    var my_timer:Timer = new Timer(1000);//create a new timer that ticks every

                    second

                    my_timer.addEventListener(TimerEvent.TIMER, onTimer);

                    my_timer.start();

                     

                    //MONTH AND DATE

                    var months:Array = ["Jan", "Feb", "Mar", "Apr", "May", "June", "Jul", "Aug",

                    "Sept", "Oct", "Nov", "Dec"];

                    var days:Array = ["Sun", "Mon", "Tues", "Wed", "Thurs", "Fri"];

                    var todayIs = (days[my_date.day] + "," + " " + months[my_date.month]  +" " +

                    my_date.date + " " + my_date.fullYear);

                    trace(days[my_date.day] + "," + " " + months[my_date.month]  +" " +

                    my_date.date + " " + my_date.fullYear);

                     

                    //Text Loader

                    var textLoader:URLLoader = new URLLoader();

                    textLoader.addEventListener(Event.COMPLETE, textLoaded);

                    textLoader.load(new URLRequest("assets/phoneList.txt"));

                     

                     

                    var ampm:String = new String();

                    var zero:String = new String();

                     

                    if (my_date.hours<12) {ampm = "AM";

                    }

                    else{

                    ampm = "PM";

                    }

                    while(my_date.hours > 12){my_date.hours = my_date.hours - 12;

                    }

                     

                    if(my_date.minutes < 10){zero = "0" + my_date.minutes;

                    }

                    else{

                    my_date.minutes;

                    }

                     

                     

                    function onTimer(e:TimerEvent):void {

                    //my_date = new Date();

                    trace(my_date.hours + ":" + my_date.minutes);

                    }

                     

                     

                    var myDateTextBox:TextField = new TextField;

                    myDateTextBox = new TextField();

                    // myDateTextBox = todayIs;

                     

                    var dateStyle:TextFormat = new TextFormat;

                    dateStyle.color = 0xFFFFFF;

                    dateStyle.size = 48;

                    dateStyle.font = "myriadMm";

                    dateStyle.align = "left";

                     

                    var myTimeTextBox:TextField = new TextField;

                    myTimeTextBox = new TextField();

                     

                    myDateTextBox.text = String(days[my_date.day] + "," + " " +

                    months[my_date.month]  +" " +  my_date.date + " " + my_date.fullYear);

                    myDateTextBox.width = 600;

                    myDateTextBox.x = 70;

                    myDateTextBox.y = 70;

                    myDateTextBox.setTextFormat(dateStyle);

                    //Add it to the stage;

                    containerStage.addChild(myDateTextBox);

                    myTimeTextBox.text = String(my_date.hours + ":" + my_date.minutes + " " +

                    ampm);

                    myTimeTextBox.width = 600;

                    myTimeTextBox.x = 70;

                    myTimeTextBox.y = 117;

                    myTimeTextBox.setTextFormat(dateStyle);

                    //Add it to the stage;

                    containerStage.addChild(myTimeTextBox);

                    //Event Listeners

                    phone.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);

                     

                    function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void

                    {

                    trace("directory ready");

                    }

                     

                     

                    simpleGreen.addEventListener(MouseEvent.CLICK,

                    fl_ClickToGoToAndPlayFromFrame_2);

                     

                    function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent):void

                    {

                    navigateToURL(link, "_self");

                    }

                     

                    videoDirectory.addEventListener(MouseEvent.CLICK,

                    fl_ClickToGoToAndPlayFromFrame_3);

                     

                    function fl_ClickToGoToAndPlayFromFrame_3(event:MouseEvent):void

                    {

                    trace("Video Player is Ready");

                    }

                     

                    function textLoaded(evt:Event):void

                    {

                    info_txt.htmlText = textLoader.data;

                    }

                     

                    With warmest regards,

                     

                    Mary Crotteau

                    Graphic Design Specialist

                    Sunshine Makers, Inc./Simple Green

                    • 7. Re: Is it possible to load a URL on stage?
                      kglad CommunityMVP

                      use:

                       

                       

                      import flash.events.MouseEvent;

                      import flash.text.TextField;

                      import flash.text.Font;

                      import flash.text.TextFormat;

                      import flash.display.Sprite;

                      import flash.text.*;

                      import flash.filters.BitmapFilter;

                      import flash.filters.BitmapFilterQuality;

                      import flash.filters.BlurFilter;

                      import flash.display.Bitmap;

                      import flash.display.Loader;

                      import flash.net.URLRequest;

                       

                      var link: URLRequest = new URLRequest("http://simplegreen.com/");

                      //ADD CONTAINERS

                      var containerStage: Sprite = new Sprite();

                      containerStage.tabChildren = false;

                      stage.addChild(containerStage);

                       

                      //DATE TIMER

                      var my_date: Date;

                      var my_timer: Timer = new Timer(1000); //create a new timer that ticks everysecond

                       

                      var dateStyle: TextFormat = new TextFormat;

                      dateStyle.color = 0xFFFFFF;

                      dateStyle.size = 48;

                      dateStyle.font = "myriadMm";

                      dateStyle.align = "left";

                       

                      var myDateTextBox: TextField = new TextField;

                      myDateTextBox = new TextField();

                      myDateTextBox.width = 600;

                      myDateTextBox.x = 70;

                      myDateTextBox.y = 70;

                      myDateTextBox.setTextFormat(dateStyle);

                      //Add it to the stage;

                      containerStage.addChild(myDateTextBox);

                       

                      var myTimeTextBox: TextField = new TextField;

                      myTimeTextBox = new TextField();

                      myTimeTextBox.width = 600;

                      myTimeTextBox.x = 70;

                      myTimeTextBox.y = 117;

                      myTimeTextBox.setTextFormat(dateStyle);

                      //Add it to the stage;

                      containerStage.addChild(myTimeTextBox);

                       

                      my_timer.addEventListener(TimerEvent.TIMER, onTimer);

                      my_timer.start();

                       

                      //MONTH AND DATE

                      var months: Array = ["Jan", "Feb", "Mar", "Apr", "May", "June", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"];

                      var days: Array = ["Sun", "Mon", "Tues", "Wed", "Thurs", "Fri"];

                       

                      //Text Loader

                      var textLoader: URLLoader = new URLLoader();

                      textLoader.addEventListener(Event.COMPLETE, textLoaded);

                      textLoader.load(new URLRequest("assets/phoneList.txt"));

                       

                      var ampm: String = new String();

                       

                      function onTimer(e: TimerEvent): void {

                          my_date = new Date();

                          myDateTextBox.text = days[my_date.day] + "," + " " + months[my_date.month] + " " + formatF(my_date.date) + " " + my_date.fullYear;

                          if (my_date.hours < 12) {

                              ampm = "AM";

                          } else {

                              ampm = "PM";

                          }

                          var hours:int = my_date.hours;

                          if(hours > 12) {

                              hours-=12;

                          }

                          myTimeTextBox.text = formatF(hours) + ":" + formatF(my_date.minutes) + " " + ampm;

                      }

                       

                      function formatF(n:int):String{

                          var s:String = n.toString();

                          while(s.length<2){

                              s="0"+s;

                          }

                          return s;

                      }

                       

                      //Event Listeners

                      phone.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);

                      function fl_ClickToGoToAndPlayFromFrame(event: MouseEvent): void {

                          trace("directory ready");

                      }

                       

                      simpleGreen.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);

                      function fl_ClickToGoToAndPlayFromFrame_2(event: MouseEvent): void {

                          navigateToURL(link, "_self");

                      }

                       

                      videoDirectory.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_3);

                      function fl_ClickToGoToAndPlayFromFrame_3(event: MouseEvent): void {

                          trace("Video Player is Ready");

                      }

                      function textLoaded(evt: Event): void {

                          info_txt.htmlText = textLoader.data;

                      }

                      • 8. Re: Is it possible to load a URL on stage?
                        EGBAR.Mary Community Member

                        Thank you so much! One question, the text is not listening to the style. It

                        displays small and serif.

                         

                        With warmest regards,

                         

                        Mary Crotteau

                        Graphic Design Specialist

                        Sunshine Makers, Inc./Simple Green

                        • 9. Re: Is it possible to load a URL on stage?
                          kglad CommunityMVP

                          use:

                           

                          tf.defaultFormat=dateStyle;

                          • 10. Re: Is it possible to load a URL on stage?
                            EGBAR.Mary Community Member

                            That didn't work either.

                             

                            Mary

                            • 11. Re: Is it possible to load a URL on stage?
                              kglad CommunityMVP

                              didn't you see an error message???

                               

                              anway, that should be

                               

                              tf.defaultTextFormat=dataStyle;

                              • 12. Re: Is it possible to load a URL on stage?
                                EGBAR.Mary Community Member

                                Yes!!!!

                                Thank you sooo much!

                                 

                                myDateTextBox.defaultTextFormat=dateStyle;

                                • 13. Re: Is it possible to load a URL on stage?
                                  EGBAR.Mary Community Member

                                  P.S. Is it possible to remove my phone and address on all the entries on the

                                  thread?

                                  • 14. Re: Is it possible to load a URL on stage?
                                    kglad CommunityMVP

                                    you're welcome.

                                     

                                    and yes, i removed that info from your messages.  (happy holidays to you all up the 405 from me in oc.)