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

how can i have a pop up message in flash?

New Here ,
Mar 19, 2011 Mar 19, 2011

how do you do this in flash

TOPICS
ActionScript
6.3K
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
LEGEND ,
Mar 20, 2011 Mar 20, 2011

Create a movieclip and control its visible property via whatever you intend to use to make it appear.  If you need the message to be dynamic, use a dynamic textfield.

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
New Here ,
Mar 20, 2011 Mar 20, 2011

In Flash you could open a javascript popup interfacing flash and javascript with the ExternalInterface class.

for example you have a javascript function called "showThePopUp", you can call it in as3 with

ExternallInterface.call("showThePopUp");


If you want the popup be part of your application I suggest you building your own popup as a singleton class.

I Hope it helps!

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
Engaged ,
Mar 20, 2011 Mar 20, 2011

Hey leleguera,

May I ask you a question?  You mentioned if you want the popup to be a part of your application to make the popup a singleton class.

I am curious to why you believe it should be a singleton class?  I'm not passing any judgement at all.  I'm merely curious to your reasoning.

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
New Here ,
Mar 22, 2011 Mar 22, 2011

Hi FeZEC,
I like curious people like me!

I have been inspired by the Alert Flex class.

In this way I have something that I could call everywhere without instantiating it around the code.

For example I create a singleton class called Popup, that has a show method
Popup.show(this, "my message");
where "this" is the reference of the display object I want to add/remove the popup.

However it is my reasoning, I really never tested it in a real project.

What do you think about?

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
Explorer ,
Mar 22, 2011 Mar 22, 2011

suppose u created a mc that name is Mess(); that contains a textfield:txt button cls;

create a new as3 class let it goes like:

public calss Popup(){

public static  function show(s:string):void{

var mess: movieclip=new Mess();

mess.txt.text=s;

addchild(s)

s.cls.addeventlistener(mouseevent.click,clos);

}

private function clos(e:Mouseevent):void{

MovieClip(e.target.parent).removechiled(e.target)

}

}

now in your fla file (which contains Mess mc)

import Popup;

or #include popup.as

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
Engaged ,
Mar 23, 2011 Mar 23, 2011

Well of course programming is programming and there are millions of ways to trace the words 'HELLO WORLD', I am merely curious because I find a lot of people falling back on the use of the static modifier.

While its not wrong, its not really proper either.

Static members means that a client Client being another object or the document class or a mc...etc.. it means the client must be aware of the Qualified name of a class.

PopupClass.Popup()  This binds that client to the class.. and will need to be edited in the future if the Popup class changes.

The use of the static is only to make it a class member which generally aims to preserve memory among 2 or more objects that would potentially carry the same knowledge.

example

a treeclass

public class Tree{

age:int    //4 bytes

size:int    // 4 bytes

location:String   //4 bytes

}

now lets make 2 instances of these.

var tree_1:Tree= new Tree()

var tree_2:Tree= new Tree()

in total we are using 24 bytes.. ok not all that many bytes to be concerened about.

But lets say all our trees were Sequioas

Then that means their location will always be in the amazon.

then we dont need each location to be within the trees but rather as a class member

public class Sequias{

static var location="Amazon"  //4 bytes

age:int    //4 bytes

size:int    // 4 bytes

}

var tree_1:Tree= new Tree()

var tree_2:Tree= new Tree()

Now we have only utilized 20 Bytes.

IF there is reason to have only 1 and no other popups then a singleton is a good idea.. which makes use of the static memebers

but if there could ever be 2 or more then an object should just be built into the frame work whose sole purpose is being the popup.  its often unwise to use global members

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
Explorer ,
Mar 24, 2011 Mar 24, 2011
LATEST

thnx FeZEC your replay was very helpful for me

^_^

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