Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Entering Data Without LOSING IT?



Hey all,
I hope this is a straightforward question. Although the answer may not!! augh...

Well I would like to use a mixture of Flash MX/PHP/mySQL. I currently have a form that people fill out in PHP that gets input into mySQL. I want to convert the HTML and use FLash for that and use the PHP scripts in the background.
The problem is this, (which i had with the HTML previously).
As you fill out the form, some of the drop down's may not have the correct info in it (ex: location, job title)
So I would like to be able to click on a button to the right of it and open a little window and fill in the missing data. Then that inputs it into mySQL. You close that window and go back to the drop down and Voila! Its in there now and you can proceed.
What I am trying to do is keep the user in the same page without leaving it.
Is this possible in Flash?
I was thinking about loading a separate movie(.swf) with
_visible = false, and then just having the button activate that movie when you need to fill it in...
But what about the drop down? How do I get "just" the drop down to retreive the new data with refreshing the whole page and losing the data that was already input into the text fields above?

Any info would greatly be appreciated thanks!!!

Indy



FlashKit > Flash Help > Flash MX
Posted on: 09-28-2002, 02:06 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Entering Different Data In The Same Input Area
I'm just learning as2.0 and have a few questions (about switch and/or if/else statements?)

I have a movieclip with 20 buttons in it (each button is someones name).
When I click on a name(button) another movie clip plays(opens a box) and then I want it to "load" information(another movieclip, for example, titled "labrainfo") about that person in that set area. Then If i were to click another name, I want the movieclip to run again but this time have the new persons movieclip (ex. "lane") load instead.


What do i need to do?
Right now, it is clicking on the persons name/button that activates the movie clip, now i just dont know how to load different mc's in the same "area"

Hopefully this makes sense.
Thanks!

Entering External Data Into Array
I have written a simple program to randomly generate the name of a student from my class. Other teachers have asked if they could have a copy but as you can see from the code, I have to manually enter their students' names into the array.

I wonder if there is a way to enter a list of names into the array from an external file so that teacher's can enter their own students' names and change them when needed.

If you can help it would be much appreciated.

(here is the code for a button that generates the students names)

on (release) {
_root.student1_txt.text = "";
myStudents=["Chloey","Paul","Rachel","Kudzayi","Josiah","S arah C","Daniel C","Micahel","Daniel Ha","Daniel He","Amanda","Tammy","Zach","Sam","Sarah M","Xanthe","Charlotte","Bethany","Luke","Jessica" ,"Cameron","Kimberley","Ellie","Lisa","Alicia","Er ic"]
x = Math.ceil(Math.random()*26)-1;
_root.student1_txt.text=myStudents[x];
}

Tabing To Next Text Filed For Entering Data?
Hello, I Have two text fileds : UserFirstName and UserLastName. I would like to be able to press tab and make move the cursor go from one to the other. So far I have tried the below code, which does not work

on (keyPress "<Tab>") {
if (Selection.getFocus() == "_root.Main.D1netToolKitLinks.EmployeeLocatorSub.S earchByNameMovie.UserfirstName") {
Selection.setFocus("_root.Main.D1netToolKitLinks.E mployeeLocatorSub.SearchByNameMovie.UserLastName") ;
}
}

Any help
Thanks

Is There An Easy Way To Test For Field Validation On Entering Data In A Form
I have a Flash MX Form that sends data to a MySQL DB. I want to be able to validate the field type on input. When someone enters a phone number and trys to use a text chr I want it to display an error.

Any ideas on the simplest method of doing this?

Variables Losing Their Data :(
Hi guys! Seems like I'm forever posting here at the moment!

I'm having a problem where AS seems to be losing data that I've stored in variables when it loops back to the start of a movie clip. I'm not sure why, because I'm not re-declaring the variables everytime at the start, they get defined in a button function.

Basically, what I'm trying to do is set a flag variable, and another called 'continueOnFrame'.

When the movie loops back around, it checks to see if the flag has been set to 1. If it has, then it goes to the frame number contained in 'continueOnFrame'.

Or at least, that's what it SHOULD do. I ran a trace on the variables, and the button function sets them fine, but when the movie lops it sets them to 'undefined' again

Here is the code for frame 1:

Code:
stop();

trace("Flag = "+flag+" / continueOnFrame = "+continueOnFrame);

if (flag == 1) {
gotoAndPlay(continueOnFrame);
};

news_btn.onRelease = function() {
trace("pressed");
gotoAndPlay(2);
};

about_btn.onRelease = function() {
trace("pressed");
gotoAndPlay(61);
};
And here is the code which actually defines the variables (frame 35 of the movie):

Code:
stop();
news_btn.onRelease = function() {
trace("news_btn pressed");
var flag = 0;
var continueOnFrame = 0;
trace("Flag set to: "+flag+" / continueOnFrame set to: "+continueOnFrame);
gotoAndPlay(36);
};
about_btn.onRelease = function() {
trace("about_btn pressed");
var flag = 1;
var continueOnFrame = 61;
trace("Flag set to: "+flag+" / continueOnFrame set to: "+continueOnFrame);
gotoAndPlay(36);
};
contact_btn.onRelease = function() {
var flag = 1;
var continueOnFrame = gotoAndPlay(36);
trace("success!");
};
I'll attach the .fla file as well if it helps. I'm using MX2004 (although, I've saved the file in MX format).

[F8] Losing Data On The Way To Database
Let me tell you the great story of Mr. and Mrs. Data.
Mr and Mrs. data live in the flash app and they want to meet some friends in the database. They have to cross the internet forest before reaching the database but the problem is that Mrs. data always lose herself in the internet forest and she never arrives with her husband.
Sad story isn't it ?


Well, now seriously,
I have this portion of code in my swf :

PHP Code:



_level1.nom = String(username);
_level1.country = Number(country);
_level1.score = Number(TTS);
trace(_level1.nom+'  '+_level1.score+'  '+_level1.country);
loadVariablesNum(*adress of my PHP file*, 1, "GET");




trace outputs exactly what I want. Example "John 120 8".

The php script for inserting into DB is the following one :

PHP Code:



$conn = mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db($db_name,$conn);
$sql1 = "INSERT INTO $db_table (nom,country,score) VALUES ("$nom","$country","$score")";
$result1 = mysql_query($sql1);
mysql_close ($conn);





And in the end, only the "country" data arrives in the database. The name and score are "lost"

Does anybody know how to solve this ? Any idea is welcome =)

Losing XML Data When Moving Between Frames
Now missing patches of hair on this!

Here is the original thread Loading data from xml file...strange conflict?

Can anyone offer any additional suggestions?

Losing XML Data When Moving Between Frames
Now missing patches of hair on this!

Here is the original thread Loading data from xml file...strange conflict?

Can anyone offer any additional suggestions?

How To Prevent Losing Data When Browser Refreshes
When I refersh my browser the movie moves back to the first scene, 1st frame and destroys all variables and data. Can this be avoided? If so can someone help me out please.

Thanks.

Imprting Swfs Into Fla But Losing Xml Data In Dropdowns
I am importing four swfs into a master fla. Swfs are loading beautifully but the dropdown functionality (xml data) isn't showing up in the main SWF. The four child swfs all have differently titled xmls. not other errors. just the blank dropdowns.

master fla buttons look like this

europe_btn.onPress = function () {
_root.createEmptyMovieClip("container", 1);
loadMovie("Europe.swf", "container");
container._x = 0 ;
container._y = 0 ;
}

do i need to load xml in the master as well?

Entering Name
Can someone please tell me how to make it so that they enter their name in an input text then it gets showed in dynamic texts. Do I do it with var? Please help.
Thanks.

Entering Javascript Into Mx? Possible?
Hi there.

I'm required to do the following and I'll need to use javascript with mx - if possible...

I've created a vertically oriented nav bar that when rolling over one of the links, it drops down another level of links (whilst moving the rest of the first level links to below those).

You select one of the second level links.

It brings up a new page using the same nav bar however the nav bar needs to be extended with corresponding link highlighted.

Does anyone know, other than using frames, how and what javascript I could enter into the flash file to tell it to do that?

I'm thinking of just recreating the whole nav using javascript, but i love this flash nav that I did, i think it looks sharp and works well with the site i'm developing. I'm still a newbie, so it might be that i redo it anyway. Any help would be GREAT!

thanks (www.colligo.com/new/01_organizations/support.asp

Entering '' In A String
Hey,

i am trying to enter a file address such as C:folderjosh as a value for a variable. How do I make the '' not read as a file address and just a character/letter in the string

Help much appreciated

Entering A Name And Using The Name Later In The Flash
ok i;m making an RPG and i wanna know how to choose a name for your character.

So you get to type your name in and click ok, and then it will go hello "name".

so it goes hello and says the name u just typed in.

If ne 1 could help me with this i would greatly appreciate it

Entering And Exiting A CAR
Hey again!

Once again I need some help, and I am looking to the WONDERFUL flashkit community for it ...

I am currently making a game, and I decided that as part of my game I wany my character to be able to drive a car. So after hours of attempts I figured Id see if anyone here knew how to do it and could maybe help.

I quickly made of a fla file containing a character and a car. If anyone knows of how I could make my character be able to get into the car and then (the player) controls the car and drives it around, i would be SO greatfull

Thnx a million - SecondComing114

Entering Frames
i'm creating a game and i have different levels and i want different objects to enter at different levels. How would i go about making this object enter at a certain frame.

Entering Numbers
Hi all,

Iam a beginner in flash but have finished with the basics. While I was thinking about getting some numbers from the user side, i was not able to do that. I tried using the text box and making it as input text in the properties, to enter the numbers, now iam not completely familiar with what to do, sat the whole night trying to figure out some way but of no use . Can someone please help me out? thanks in advance

Sam

Entering A String Of Characters
does any one know a script that will read in a string of key presses, then on entering this string do something else like play a movie or getUrl

any help would be great.

i have tried using the on mouse(keypress) and the keydown on a MC

Ok Entering Hell At Mach 3
need to get arabic text in asap and not having any luck - suggestions please!!!!!!!!!!!!!!1

cheers

Help With A Display Pad &entering Stufffffffff.....
hey everyone, i have a task i cannot figure out!!
i am no good at variables but i need to learn how i guess.
anyway i have a display and a keypad, kind of like the one on the side of the keyboard? set up like

789
456
123
0

you know.

anyway, the number 8 also represents the direction North and is marked with an N, and 4 is W, 6 is E, 2 is S.

when the user presses them... the display changes.
first the display shows up something like:

N78 23 90

siiiiiiiigh

so the first thing the user hits should be one of the direction keys. i'm guessing i'll use something with charAt(0) and then a number-

how can i set up my buttons so that the FIRST time the user hits one, a letter is displayed (if they hit a button with a letter, too), and after that, you can type in numbers? (I think if the user hits one of the other buttons, with no direction/letter on it, nothing happens.)

thanks all!![

Entering Time From A Keypad
Hi all,

I have been making a keypad which you can enter a time amount for, i.e., your microwave, however I am having a problem getting it to work.

Here is the flash movie: Click to view the movie.

Here is the code:

Quote:




var numOneVar:Number = 1;
var numTwoVar:Number = 2;

btn1.onPress = function () {
dynSeconds.text += numOneVar;

if (dynSeconds.text <10)
{
dynSeconds = "0"+dynSeconds;
}
else {dynSeconds.text <60
}
}

btn2.onPress = function () {
dynSeconds.text += numTwoVar;
}
{




'dynSeconds' is the dynamic text field for the seconds of the clock. 'dynHoursMinutes' is for hours and minutes, and they should each hold two numbers. "hm"+:+"ss" for example.

I am only working with two of the ten buttons now for simplicity; if I can get those two to work, the rest will be a matter of cutting and pasting the code.

As you can see, the movie doesnt really work. Im not sure what I am doing wrong. As well, the hours and minutes need to obviously account for what is going on with the seconds, meaning you should be able to set a time for 11:11 if you want.

Any corrections?

Haus

Entering A X Y Reference And Curser Goes To It
I have constructed a flash movie and require the user to be able to type in an x y postion and the cursor goes to it.

Does anyone know how to do this

Thank you for your time

Code Entering Game
Is it possible to use the if function in actionscript to create a game where you enter a code or word into it press a button and if its right go to a frame saying correct. If its wrong it goes to a frame saying wrong try again. I've tried but they always either go to just one of the frames.

Please help

Reloading A MC When Entering A Frame
Hi. Hope you’re doing good. Apologies abound if this is in the wrong forum (should this be in the newbie section??).

The Problem :
MC2 (within MC1) does not reload when MC1 enters frame containing MC2 the second time.

The Background :
MC1 is on the main timeline and contains many buttons that direct it to go to various frames within itself. In every frame of MC1 is MC2, which is used as a mask. MC2 generates MCs (within itself??) using the attachMC function. (MC2 has a stop (); in its first frame and so every time MC1 enters a frame it directs MC2 to gotoAndPlay (2); and hence generate MCs within itself to generate the mask). So lets say I am in MC1.frame2 then go to MC1.frame3 and back to MC1.frame2, now the mask is already there and so everything is visible. However, MC2 does generate the movies within itself for the mask but it just replaces the previously loaded MCs within itself (since things are loaded at the same depths).

The Efforts :
-At first I thought that the problem was that in every frame of MC1, MC2 has the same instance name. I tried changing that but now the mask does not work at all
-I tried setting the various MCs within MC2 to their first frames (where nothing is visible) but this turned out to be too processor intensive
-I tried reading around the forums to find how to reload/unload a movie but.....

The Gratitude :
Much!!!!!!!

Entering In Advanced World
Hello everybody,

I am an intermediate user of flash would like start action script from scratch
can anybody guide me, from where do i start to learn as.

Thanks
Sorry for poor english

Entering SWF Files At Different Points
I am creating a header for my site which shows pictures at the top to show the used what "room" they are in ... the index file directs them to their initial room ... currently i see having to make a unique SWF file for each "room" ... what I would like to do is enter my base SWF file at different points ... say BMX starts at FRAME 2 ... ROAD at 1 and so on ...

so I would call the file ../header.swf=2 ... or sometine like that.

Is this possible in flash?? Or is there a "template" I can make (similar to Dreamweaver's Templates) in flash so if I change pictures or colors i will not have to do it for each unique SWF file??

For reference ... to see what i am doing go to: http://66.70.241.63/BMX/bmx_frame.html currenlty "ROAD" "MTB" and "BMX" buttons work ...

Entering E-MAIL For A Newsletter
Greetings All - not been around for a while, I've moved to Australia for a bit.

In any case am now having a look at doing a little site for the law firm I'm slaving away in and I'd like to know how I can include a panel where visitors can leave their email addresses so I can send them a newsletter of sorts.

Any ideas??

Scrolling Mc By Entering Frame?
hi there...

i have a site i'm working on where i currently have the stage scroll left or right when a button is pressed. each button has an instance name, and the stage is an mc with the following code:


Code:
onClipEvent

Code:
(load) {
_x = 0;
_y = 0;
div = 5;
}onClipEvent (enterFrame) {
_x += (endX-_x)/div;
_y += (endY-_y)/div;
_root.home.onRelease = function() {
endX = 0;
endY = 0;
};
_root.music.onRelease = function(){
endX = -300;
endY = 0;
}; _root.biography.onRelease = function() {
endX = -600;
endY = 0;
};
}
this works great, but now i need to change this so that the scrolling starts when another mc reaches a frame, instead of when a button is pressed.

so like, when the "biography" button is pressed, rather then scroll the stage, it's now going to tell a mc on the stage to play an exit animation. when that animation ends, i need the last frame to tell the stage to scroll to the desired destination. hopefully that makes sense.

i'm having a hard time figuring out the syntax to transfer my onrelease function to an onenterframe function. any help would be most appreciated!

Entering A Number Into Two Different Textboxes.
Hey all,
I've been scratching my head on this for a little too long.

I have two input text boxes. I need to enter a number (1900) into the first box then hit the 'Enter' button, then enter a number (50) into the second box right below the first.

After the 'Enter' button is pressed it needs to lock-in the required value, by selectable = false.

My problem is...I can get the first number to work. I type in the number, press 'Enter', it changes the textbox value to selectable = false...everything is good for that part.

But the second number is where I am having trouble, it seems the function is called, but that's it...nothing else happens.

Any help is greatly appreciated.

Note: I have attached the file.

New Member Entering Comunity =)
Hey People!

I'm new here but hope to contribute something to your comunity.
Got a question first though.. Hope you'll be able to help me.

I have a fadeout effect when clicking my menu. This works fine when your on the mainpage but as soon as any other menu choice has been made my "blipper" jumps over the fadeouteffect.

Is there a way, when clicking a button, to tell that you want the "blipper" to go 10 frames before executing the choice?



Sorry for my bad english.

Thanks in advance.
//Gustav

Entering Flash To Asp.net Page
I'm building my first web site,i'm using visual web developer and asp.net language.i want to enter some flash contents to the web page and i was wondering how i can do so,thnx.

Event On Entering Frame
This is a noob question but I can't seem to find an answer.

I'm looking for an event handler that will execute once when the playhead enters a frame.

I've got a movie clip which plays for a few seconds and is then stoped on it's own timeline with a stop(); action. At the end of the timeline of the movie which contains the movie clip there is another stop action and it's at this point that I'd like to jump the playhead forward to a labeled frame.

I'm guessing it's something like this:

this.unknownEventHandler = function():Void {
   
  myMovieClip.gotoAndPlay("labelName");
};

My initial thought was onEnterFrame, but that seems to fire at the same frame rate as the movie rather than just once as the playhead enters the frame.

Any help appreciated.

How To Call A .swf After Entering Text...
Hello all,

What I am trying to do is...

I have an input field that I want the user to be able to type in a 6 digit number (112233). After this I want them to press a button and have it open up another .swf (112233.swf) into level_10 of the same movie. I am more of a designer and I am having problems coding this. I have had some other suggestions but could not get them to work. I had this on the button but couldn't get it to call anything:

[as]

on(release){
myPath=bandFolder + "/intro.swf";
loadMovieNum(myPath,10);
}

[as]


"The code above will work only if each and every band folder has a file named intro.swf in it. It could be any other name, of course, the point is to have them all be the same, so you know which filename to put into myPath."

I need help setting up the button to work with the text that is inputted into the text field.

Does anyone see how to make this work?

Thanks.....tg

Call Function On MC Entering
Hello,
I know this is very simple and is the base for actionscript, but i can't get it right. Very frustrating.
I'm trying to use the tween class in mx 2004;
i want two MC (topLogo,bottLogo) to move when they enter the frame then stop.
they are inside a MC on the main scene.

I tried on enterFrame, onClipEvent (load) on a frame, on the MC, on a combination of both, and keep getting error messages. I can't figure out how to call a function on anything but a button (onPress, onRelease, etc.)

i have this on the first frame of the MC containing the MCs to tween.
I found it on the macromedia dev. site
code:
AS
import mx.transitions.Tween;
import mx.transitions.easing.*;
new Tween (toplLogo_mc, "_y", easeType, 99, -197, 3, true);
new Tween (bottlLogo_mc, "_y", easeType, -203, 99, 3, true);
/AS

Where should I put this code, if it is the right code to use.
This is driving me nuts.

Thanks

Stop Mc Resetting Entering New Scene?
Hi..

I have a looping movieclip that runs in the bottom corner of my flash presentation. When I go to the next scene, the mc resets to frame 1 and begins playing again - is there a way of overriding this other than putting all the scenes into 1 (nightmare!!)?

Any suggestions greatfully received!! cheers

Entering Mouseover State When It Shouldnt...
I have some text buttons forming a menu bar, these buttons have over states with a small tool tip offest from the button. The problem is when the mouse moves over the tooltips area, the mouseover state is entered and the tooltip appears. However, i only want the tooltip to display when the mouse is over the button, and not when its over the tooltip as well.

Any ideas?

Cheers

Woff

HELP Entering A Variable And Then Displaying It Later In A Movie.
Hello my fellow flashers

May i please get some help on making a box where you enter a variable ie- persons name into a box and then later appearing in a body of text? or in the movie?

thx

Entering A Website Full Screen?
I actually have 2 questions about this guy's site?
I love it,
check it out
http://www.monnone.com

anyways,

1. Does anyone know where to add the code needed to enter a site FULLSCREEN????
2. How do you lose the scrollbars on the right side????

cool site eh....

StartDrag // Entering Correct Constrain #'s?
Hello all,
I have been trying to figure out how to set the correct constrain numbers for Left, Right, Top and Bottom for when dragging a window around. I need it to just drag in a certain area. At the moment I have a Flash file called Music control and on the main time line I have a movie called drag music. My dragmusic movie has a blank button with the following script on it. I have just through in some numbers here and got it pretty close to what I want, but I would like to know how you do it correctly.

on (press) {
startDrag (dragmusic, false, 754.3, 510.9, 472.9, 567);
}
on (release) {
stopDrag ();
}

Thanks for the help,
StevieG>>>

Prevent Character Entering In Text Box
i click the numerical characters only in my flash mx however when i fun the program it still lets me enter characters not just numbers, is there any actionscripting that will solve this problem?

Help Stop Sound From Entering Cache
Hi guys,

I ran into a problem and I can’t seem to get over it. I have to build a "music sample browser" which basically lets you hear to different samples of music. Well the problem lies when it comes to copyright laws. I don’t want the people to be able to actually "save" the samples, instead only listen to them.

Also, there are a lot of samples so if I made the user load all of them at run time, they would sit there for a day even on a broadband connection. Anyway, when I do a loadSound and I call it from the server, the browser caches it! So later i can access my Internet page history and just retrieve all the sounds...

I also tried streaming... little did I know, when I call a file to be streamed, download managers, if they are on, can actually intercept the mp3 file and download it straight to the computer... again a bad thing.

Does anyone know how I can stop the sound from caching?

The way I have it set up is, a function that makes a new sound object, loads the sound and the sound loader and then plays the sound. All the sounds are in separate sound objects.

Also, I need a way to "stop loading" a sound. For ex. if a person accidentally clicks on a 3 meg file on a dial up connection, there has to be a way of saying stop load instead of reloading the page?

ANY help is appreciated and please help. As you can see, I keep running into problems and still don’t know the best way to get over this. THANKS!!

When Entering Frame X, Wait For X Time ?
How do I accomplish this ? When entering frame 25, it should wait for a while, then continue .

Empty ComboBox After Entering A New Frame
Hello

As this is a forum where there arent any stupid question. I would ask mine

I am using some ComboBoxes in my little Programm.
One of the Combos (its instance name is vol) is filled like this:

Code:
volProvider = Array ("Volume 1", "Volume 2", "Volume 3", "Volume 4");
_root.vol.dataProvider = volProvider;


Then i am defining a variable

Code:
chosenVol = _root.vol.selectedIndex;


When i make an

Code:
on (change) {
gotoAndStop(chosenVol+1);
};

(This is not the right code! But i hope you know what i want to do. You select for example Volume 2 in the Combo and the Flash Movie jumps to Frame Number 2.)

And there is another ComboBox with the name vol it gets empty :-/
How do i avoid this problem?

Thanks in advance

Entering Text Into An Array From A Form
Hiya

I'm still working on the "wheel of fortune" game. I've managed to set up an array of "name1, name2, name3..." in actionscript (thanks to nunomira ) and then depending on how many entries there are the circle splits into that many segments, and displays the name.

Is there a way I can create a form so that you can enter the names directly onto the stage rather than going into the coding? I've set up 'input text' boxes that allow you to type into them but I need them to connect to the array.

I've tried various things with the instance names of the boxes...any ideas??

Thanks so much!

Oddest Problem Ever-entering Symbols
Hello! Soooooo I just got a new pc and i've installed flash mx 2004 on it. I noticed right away that whenever i double click to enter a symbol or group, flash does this strange laggy thing where immediately after double clicking the object, a dotted rectangle appears very small in the middle of it and gradually (very slowly) expands to the size of the document. THEN i am allowed to edit the symbol/object. Same thing on double clicking OUT of the symbol. Anyone know why it's doing this? I tried uninstalling and reinstalling flash, restarting the computer, etc, but it's still there...

Entering A Number Variable Into A Textbox
There's probably a way to do this.

I have a Number variable:
var score:Number = 0;

and a dynamic textfield manually made on the stage:
score_txt

Now I know I can put a String variable into the textfield:
var score:String = "0";
score_txt.text = score;

But how can I stick in the Number variable into the textfield instead? Flash tells me off if I try just putting score_text.text = score, by saying 1067: Implicit coercion of a value of type Number to an unrelated type String.

Thanks for reading! Joe

Loading New Sound On Entering Frame
Hi

I'm trying to get a sound to play automatically using the onEnterFrame command:

onEnterFrame = function() {
sound = new Sound();
sound.attachSound("sound1")
sound.start();
sound.setVolume(40);
}

The above coding does not work for some reason, but I can't work out why. Can anyone give me an idea of where I've gone wrong.

Cheers,

Phil

Entering Frames, Object Lifetimes
Ok, I have posted on this subject before but no one has ever answered. It continues to bite me so I'm giving one more desperate cry for help!

I have one SWF, authored in CS3, used for a dialog with several screens. Each screen has its own frame on the main timeline. Each screen has its own buttons and so forth that exist only in that particular frame of the timeline.

I'm loading this SWF from another application. That application wants to change screens and add listeners to individual controls on the different screens.

Say the setup is something like the following:

Dialog SWF:

Frame 1: contains button instance named "buttonFirstFrame"
Frame 2: contains button instance named "buttonSecondFrame"

Frame 2 also has an action with this trace statement:

ActionScript Code:
trace("Welcome to frame 2!");

Main application:


ActionScript Code:
var theDialog:MovieClip;  // contains the loaded Dialog.SWF. 
                         // ("stop" was called on it immediately after load so its never been to frame 2.)

trace(theDialog.currentFrame + " " + theDialog.buttonFirstFrame + ", " + theDialog.buttonSecondFrame); // --> "1 [object Button] null"

theDialog.gotoAndStop(2);
theDialog.addEventListener(Event.ENTER_FRAME, onEnterFrame);

trace(theDialog.currentFrame + " " + theDialog.buttonFirstFrame + ", " + theDialog.buttonSecondFrame); // --> "2 null null"

function onEnterFrame(e:Event):void
{
    trace("EnterFrame: " + theDialog.currentFrame + " " + theDialog.buttonFirstFrame + ", " + theDialog.buttonSecondFrame);
}

so output is:

1 [object Button] null
2 null null
EnterFrame: 2 null null
Welcome to frame 2!
EnterFrame: 2 null [object Button]

Okay... so, it appears that the following is happening:

1. When the main program calls gotoAndStop on the dialog, all the instances from the frame that is being left are immedately disconnected/destroyed.

2. The new frame is not actually initialized right away. Only after one (at least one?) "ENTER_FRAME" event is dispatched for the dialog does the new frame execute its embedded actions ("Welcome to frame 2!") and create/connect its instances.

You know, I could handle the fact that the new frame is not initialized immediately after the "gotoAndStop" call. But it really bugs me that it's still not initialized when that first ENTER_FRAME comes. I mean, come on, doesn't that mean it's entered the frame? Is this firing immediately before the frame's actions actually execute? Is there some event equivalent to "EXIT_FRAME" instead???

So my work around strategies are
1) Make all the controls exist on all frames, and just hide and show them on individual frames.

2) From the dialog SWF, dispatch some explicit "OK I'm ready now!" event from the frame action code.

#1 is awkward, makes the FLA file really messy with buttons that get hidden still showing up in the authoring tool. #2 is not too bad, but means that the application driving the dialog has to constantly add and remove listeners each time the dialog's frame changes since the instances are themselves being added and removed. I'm leaning towards #2, but it's a still little too prone to subtle ordering bugs, and if the main app has to do anything expensive with the coming and going instances (beyond just adding listeners), it's potentially inefficient.

I'm just wondering if there is anything I am missing either in my understanding of what is happening here or any better work-arounds to deal with this situation.

Thanks.

Leaving And Re-entering Flash Sessions
Hi, I see on some flash app web sites, they prompt the user to verify their intent on leaving the flash app before it leaves. Any ideas on how this can be accomplished?

To be more complete, I would also like to save some of the current states before the flash app leaves and re-load them when the user re-enters the flash app? I was thinking about saving the current states on the server under the user's ip address so that when they return I would know where to find the state file. Does anyone know if I can directly obtain the ip address from within actionscript?

Copyright © 2005-08 www.BigResource.com, All rights reserved