Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Is it possible to load a URL on stage?

Community Beginner ,
Nov 25, 2013 Nov 25, 2013

Hi,

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

TOPICS
ActionScript
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 26, 2013 Nov 26, 2013

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.tabChild

...
Translate
Community Expert ,
Nov 25, 2013 Nov 25, 2013

not unless you're publishing an air app.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 25, 2013 Nov 25, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 25, 2013 Nov 25, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 25, 2013 Nov 25, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 25, 2013 Nov 25, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 26, 2013 Nov 26, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 26, 2013 Nov 26, 2013

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;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 26, 2013 Nov 26, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 26, 2013 Nov 26, 2013

use:

tf.defaultFormat=dateStyle;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 26, 2013 Nov 26, 2013

That didn't work either.

Mary

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 26, 2013 Nov 26, 2013

didn't you see an error message???

anway, that should be

tf.defaultTextFormat=dataStyle;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 27, 2013 Nov 27, 2013

Yes!!!!

Thank you sooo much!

myDateTextBox.defaultTextFormat=dateStyle;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 27, 2013 Nov 27, 2013

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

thread?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 27, 2013 Nov 27, 2013
LATEST

you're welcome.

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines