Cannot Reload Variables/dynamic Text From Php
Hello,
New to AS, so please forgive any silly questions...
My goal is to display a text that is frequently changed. I am loading this text using LoadVars from php. So far so good: When I test the .fla it works fine, however, when I post it and try it from the web it will only work once, that is, it will not refresh the changing information.
For example, I read the time from http://www.canora.es/time.php which contains very simple code:
<?php $datime =time(); print "time=" . $datime; ?>
Then in Flash:
Technique1: I put the following code in Frame 1 code: System.useCodepage = true;
temp = new LoadVars(); temp.load("http://www.canora.es/time.php"); temp.onLoad = function(){ myArray = new Array(); for(var a in this){ myArray.push(this[a]); } testo.text = myArray[0];
};
Then I copy Frame 1 through Frame 24 (so that the whole thing would repeat itself every 2 seconds). testo is a dynamic text field placed on the stage....
Technique 2 - not working either :^( - I put the following code in Frame 1 code: System.useCodepage = true; setInterval(function () { temp = new LoadVars(); temp.load("http://www.canora.es/time.php"); temp.onLoad = function() { myArray = new Array(); for (var a in this) { myArray.push(this[a]); } testo.autoSize = "left"; testo.text = myArray[0]; //scroll the text horizontally _root.onEnterFrame = function() { testo._x -= 2; if (testo._x<(0-testo._width)) { testo._x = 300; } }; temp.unload(); }; }, 2000);
In both cases, when I Test Movie, everything works fine. However, when I embed the resulting .swf in a web page, the whole thing WOULD ONLY WORK ONCE. Somehow it seems to be unable to reload the variables.....
See how it does not work on http://www.canora.es/time.html and http://www.canora.es/time_2.html
Thanks in advance,
M
FlashKit > Flash Help > Flash ActionScript
Posted on: 06-24-2007, 08:55 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Dynamic Image Reload Is Cached. Need Fresh Reload.
I'm calling a basic image from the web, but the image is constantly updated. When the end user clicks to reload, it displays the same cached image. How to I force it to reach out and get the updated image?
Not too savy with actionscript yet and could use some help.
FYI, this is a standalone exe flash file, not a browser embeded movie.
Thanks in advance.
[CS3] Dynamic Text Without Page Reload?
Hey guys.. I have a client gallery fed from an database using ASP to pull in the thumbnails however they would like the larger image to appear within some flash on the page, I can get the movie to pull in the image id in the querystring but is there a way of doing this without reloading the page? Perhaps feeding the id to the flash a different way?
I'm tempted to delve into the Ajax world but have very little experience with it.. any suggestions?
Thanks in advance.
Dynamic Text Reload Problem
I have a Flash Slide Presentation that pulls in a lot of dynamic text from external text files. I publish it as a projector.exe file. It runs on a display 24/7 in a few buildings. It has scheduling information for the company I work for.
I need to update this text very often. I'm running into one of two problems.
1) If I set the text to reload (making a loop) each time it gets to a slide, I can not edit and save the text. I get an error in Notepad "Cannot create the C:xxx.txt file. Make sure the path and filename are correct. Of course, the file exists. I think the cause of the error is that two applications can't be working on the same file at the same time. Both Flash and Notepad want to have control of it.
2) If I take out the loop, then I can edit and save the text file, but I have to stop and restart Flash for it to pull in the new text.
Any ideas on how to avoid one of the two problems? I simply want the Flash presentation to always be running and it pulls in the text each time I modify it. Maybe there is a way to check the time/date on the file and only load it if it has been changed? I'm not sure that will cure the problem of writing to an already open file.
thanks,
Disserpring Dynamic Html Text On Reload
i have come across a strange problem
i have a html text box in a movie and have the following html text to color some of the text differently:
<font color="#0000FF">my name is </font><font color="#FF0000">kevin</font>
it colors "my name is" blue & "kevin" red
here is my AS:
this.onLoad = function() {
this.head.htmlText = '<font color="#0000FF">my name is </font><font color="#FF0000">kevin</font>';
};
you can view the swf here:
http://www.jamesmowbray.com/flash/headertest.swf
or the swf in a html page here:
http://www.jamesmowbray.com/flash/headertest.html
the problem happends when you reload the page or visit again the page twice, the text dissapers on the next visit just reload to see go! i have tested it on firefox and safari on the mac + firefox on the PC
but it seems to be fine in IE on the PC & MAC
as this i going to header on a html site people will be click back to pages and then they will presented with a blank header
it works fine if i test in flash but as soon as i look at it embedded in a html page it disappears.
but if you look at swf directly in the browser you can see the text.
i tough it might of been my html so i have used that html written by flash and it still doe it!
you take a look at fla here
http://www.jamesmowbray.com/flash/headertest.fla
i am useing MX 2004
Assigning Dynamic Text File Variables To Variables
Ok so I know exactly how to load variables from a text file and catching these variables in a dynamic textbox to show there string content. But I wanted to work with the string in the passed variable (ie from txt file) BEFORE I display the text in the dymnic text box. I seem to be having trouble assigning the passed .txt file variable to a newly created variable in my movie, it keeps saying "Undefined" when I run a trace().
<code>
//The contents of the text file looks like this
&textxxx=This is the text withing the text variabale
//1st frame, layer 2 in main
loadVariables("text.txt", _root)
//1st frame, layer 1 (below layer 2)
_root.strText = _root.textxxx
</code>
->So why does it say strText "Undefined" !? Does flash not allow variables to be assigned to variables?
If you help that would be fantastic
Reload Variables At Interval
I want to reload variables from a text file every few seconds to see if they have changed at all. How would you do this?
Right now I have the variables being loaded into a movie clip every 6 seconds? But when I change the text file on the server with a new variable, Flash still spits back the old value. Is it not refreshing the text file?
EASY: Reload Variables?
Hi,
I've a very simple flash file.
In it is a movie clip which has a dynamic text block inside.
This text block loads a string of text from a database, which is sourced via an ASP page.
All works well.. with a smal actionscript instruction on the first frame of the nested movie clip which fires the loadvariables command.
What I would like is, when the overall movie gets the end, and then it loops (as it currently does by default) I'd like to somehow, requery the ASP page so it gets new set of variables ..
At the moment, the loadvariables command is only queried once...
How do I force the requery, when I loop?
Update Variables And Reload?
Hello,
I'm loading a .txt file using a good ol LoadVars. But if i modify my .txt and reload the .txt with a button, it doesn't update it in flash, like it's in its cache or something... How to make it reload??
Any idea ???
Update Variables And Reload?
Hello,
I'm loading a .txt file using a good ol LoadVars. But if i modify my .txt and reload the .txt with a button, it doesn't update it in flash, like it's in its cache or something... How to make it reload??
Any idea ???
Why Variables Are Not Changing After Reload Of Movie?
hello,
I am loading variables to a flash movie with use of ASP: it works fine the first time. But if a user goes away from the page with the flash moive and comes back and new variables are passed to the page the old variables are stil there and are not replaced with the new ones.
Any ideas?
Thanks
Passing Variables To Flash Movie Without Reload?
Hi All,
Is it possible to pass variables into a Flash movie, and have the movie recognize this passing and do something, without reloading the page?
Specific example:
Let's say I have a simple Flash movie that displays a static logo, and then next to the logo there's a dynamic text field that displays some text - for simplicity let's say a city name.
So when you first load the HTML page, there's the Flash logo and a default value in the dynamic text field.
Then somewhere in the HTML portion of the page there's a link/Javascript/AJAX bit which, when clicked, passes a new value for that text field - in our example, a new city name.
Is there a fairly straightforward way to do this? Any help/guidance would be awesome!
Thanks.
Dynamic Vars, Dynamic Paths Using Variables And External Text Files
Hi there,
first off, apologies for the long post, but its a tricky problem to explain... and on my first post too! (sorry )
Im have a bit of bother with flash calling variables from a text file, and using them to make paths to other variables, and to control the amount of time a duplicate clip occurs. The first of these 2 problems is this:
Im loading a text file "content.txt" into _root. (this works fine)
it contains the variables:
webclipcount=2
&webhenry=hello hello
&webbutton01=henry
on the main timeline I have this button
on(press){
sectiontitle="web"
clipcount=webclipcount
}
there is a text box on the main timeline with variable name of bodycopy.
on a clip on the main timeline I have this;
onClipEvent (enterFrame) {
if (num< _parent.clipcount) {
duplicateMovieClip(thebutton, "button"+depth, depth);
this["button"+depth].name = _parent[_parent.sectiontitle+"button"+num];
this gives button01 the name henry- this works.
on the duplicated clip I have these actions:
on(mouseDown){
_parent._parent.bodycopy=_parent._parent[_parent._parent.sectiontitle+this.name]
}
so we end up with a path like:
_parent._parent.bodycopy=_parent._parent.webhenry
and it in turn should make the textbox on the main timeline contain "hello hello"
but it doesnt.
also for the duplicating clip, unless i use:
onClipEvent (enterFrame) {
if (num< 2) {.....
<snip>
it wont work either. it seems neither can be dynamic/ pulled from the text file. (well, i can get them to work!)
If I use direct paths like:
on(mouseDown){
_parent._parent.bodycopy="bloody hell it works!"
}
and
onClipEvent (enterFrame) {
if (num< 2) {.....
<snip>
it works, but not if they are dynamicly set from the txt file...
Anyone care to shed some light onto this? its doing my head in!
thanks in advance or the help.
cheers,
chris
Dynamic Text Field Receiving Dynamic Variables...
or something like that . . .
This is my problem: I'm generating _global variables via XML. Each variable represents different types of copy, of varying lengths. For Example:
_global.introduction = xmlDoc_xml.firstChild.firstChild.nodeValue;
_global.body = xmlDoc_xml.firstChild.firstChild.firstChild.nodeVa lue;
_global.summary = xmlDoc_xml.firstChild.firstChild.firstChild.firstC hild.nodeValue;
I want to create ONE text field, with scrolling, that will act as a template to house all types of content. I've assigned a variable that equals "content" to this text field. . . My problem is, I can't get the text field variable (content) to dynamically swap for the global variable (_global.introduction) in order to display the proper content.
This seems simple, but something's not working for me. Any thoughts? . . . BIG thanks in advance!
Dynamic Text: Detecting If Variables Match In Two Text Symbols?
Here's the problem:
I want to play a sound (or play an animation, whatever) if the first variable in one dynamic text is displayed at the same time as that in another dynamic text.
It works so that, when I press a button, one text field randomly displays one of "pizza" or "ham" and the second text displays randomly one of "is good", "is bad" or "yuck". Now I want it to play a sound when the random display comes up with "pizza is good".
I tried an educated guess with:
code:
if (_root.tiptext.variable == _root.tiptext2.variable) { play-sound }
but that doesn't work.
Any help?!?! (see attachment also)
P.S. don't ask why such a stupid program, it's just a test ^^'
How To Make SWF To Reload From The Start, Every Time User Reload/revist The Page.
Hi,
How can i make my flash SWF file to reload from the start every time when a user visit the site.
Like i dont want it to be saved in cache, i want to reload it from the start every time, because i have seen that once it is saved into cache, it just starts from the cache when we visit the site. So, i dont want it, i want it to reload again and again from the server whenever user visits.
I used the following meta tag:
<meta http-equiv="pragma" content="no-cache">
But it seems to be not working as the way it should. As when i re-load the page, the preload bar shows 100% loaded.
ANy idea???
Amir
Forcing Dynamic Jpg To REALLY Reload
I am trying to make a page for my webcam that will update with a jpg every second or so.
I am using some software along with my cam to do an ftp push. A new image called "webcam.jpg" is uploaded every second.
the only problem is that after the .swf file loads it for the first time, it never changes even though I tell it to in frame 1 of a looping timeline.
I have tried loading it with the loadMovie command and also by using this tutorial:
http://www.flashkit.com/search.php?t...torials&page=1
there is also a .fla that is similar to the tutorial, but really slows down a webpage and I don't think it worked anyway.
Please Help! How can I force the jpg to really reload?
Thanks in advance,
Reload Dynamic Images
Hi...
I have created a flash that allows updates an image everytime a new image is uploaded...
The flash doesnt refresh the images....
is there a way for me to delete the cache??
or is there a way around it?
thank you in advance
Dynamic Text And Variables...
What I'm trying to accomplish:
Having a list of news article headlines from a third-party vendor. (I can get this to display properly via the loadvariables command). They are displayed in dynamic text boxes. The headline is associated with a NewId #.
I need to find a way to pass that variable back to the server so it knows which new article to grab, and format a dynamic page that outputs the info. I've got the second page all coded, I just need to know if it is possible pass that variable to the second page so it will output the info that fills the dynamic text boxes in frame 2, and how to pull that info on in??
I hope this makes some sort of sense. Anyone, Beuhler??
Dynamic Text Variables
I have buttons that are dynamicly created from a data base. How can I also, when the new button is created, attach a variable to it so it can identify itself when it is clicked on?
Thanks.
Dynamic Text Variables
hi all, I have a list of items made of various instances of a movieclip with a dynamic text field inside.
Every movieclip's text must refer to a variable that MUST be inside the movieclip.
I cannot get it.
If I write "this.name" in the var area of dynamic text properties, it doesn't read the variable "name" that is inside the clip.
If I use "myTextField.text = "sdfsdfs"" it doesn't work.
So maybe I'm making some mistakes, either in coding or understanding dynamic texts usage.
Please help me.
thanks in advance
Dynamic Text And Variables?
Hey All,
I have a situation where I am adding new functionality on top of some that is already in place; heres what I have been handed......
Main timeline a movie clip that is flowed with dynamic text. The text inside the clip is a series of 3-4 questions the user can click on to view seperate video files answering that question.
Simple enough.
The request is for the user to be able to click a "favorites" button that will then somehow store these so that when the user clicks a favorites tab only the the questiuons s/he selects will be present.
Make sense?
Looks like this.......
dynamic1.txt
question 1a
question 1b
question 1 c
dynamic2.txt
question2a
question2b
question2c
User has clicked on "question1a" and "question2c" to add to his/her favorites when they click the "favorites" tab those 2 questions and these 2 only will be called.
Any help would be fantastic.
Cheers
-j-
Dynamic Text Box With Variables.. Need A Bit Of Help
Hi everyone -- I have a little problem with one of my forms on my website. Basically, there's a combo box that displays a number of products, and a quantity combo box that displays numbers (for the quantity of the selected product). Next to them, I have a button that says "Calculate Price" and on top of that I have a dynamic text box with variable "price". Also, the combo box that has the products in it has the prices of the products as data elements (for example, product one might be a spoon, and the label would be Spoon and the data would be 15 -- something like that). So what i want to happen, is when the user presses the Calculate Price button, I want the data element from the combo box to multiply by the quantity number, and I want the product to be stored in the variable Price, and then displayed in the dynamic text box. I have to following code on the Calculate button (by the way I'm using Flash MX):
on (release) {
Price = (shirtcombo.data * shirtquantity.label);
}
Now i don't know if I need like some _parent. things somewhere in there, but I just can't seem to figure this out. Any help would be greatly appreciated, I'm sure this is a really really easy problem to work out, I just don't have the experience in actionscrpit to get it working. Thanks so much!
- Dan
Dynamic Text Variables
Hey guys...
I'm trying to have a dynamic text box that pulls in a list of clients from an external text file. From that list the user will be able to click on their name and the "username" text box will automatically be filled in w/ their name. From there they can put their password in and continue on. (I know i can just have them put in a username and then type their password but my client wants it the way i just described)
right now i have a dynamic text box w/ a variable name "clients", a dyn txt box named "username" and an input txt box named "pswd".
My question is...how do i get the "clients" text to be clickable and pass on a variable to "username" so that the password code will work? Do i have to do something with xml or parent/child nodes? if so could someone please help me b/c im not very familiar with that. Thanks!
[CS3] Dynamic Text & Variables
Hi.
I've set up a Dynamic Image Gallery for my friend's website and am having some trouble getting a dynamic text description to pop up along with the image.
Basically, i have a variable called prevTop, and when prevTop = "box1" I want another variable called galleryInfo to equal featured1, which is a variable that I have imported which will be a short description of whatever the picture is. I wanted featured1 to show up as a dynamic text description of the image.
so basically if:
prevTop = box1, galleryInfo = featured1
prevTop = box2, galleryInfo = featured2
prevTop = box3, galleryInfo = featured3
and so on...
I want the description to change when the image changes. I think i need to use some sort of function() or eval(), but i'm not too familiar with how these tags work...
My actionscript knowledge is somewhat limited, but i'm trying to learn and understand how to set these things up. It seems like it should be fairly simple, but I haven't been able to figure it out yet.
Any help would be greatly appreciated.
Thanks,
Deanna
[CS3] Dynamic Text & Variables
Hi.
I've set up a Dynamic Image Gallery for my friend's website and am having some trouble getting a dynamic text description to pop up along with the image.
Basically, i have a variable called prevTop, and when prevTop = "box1" I want another variable called galleryInfo to equal featured1, which is a variable that I have imported which will be a short description of whatever the picture is. I wanted featured1 to show up as a dynamic text description of the image.
so basically if:
prevTop = box1, galleryInfo = featured1
prevTop = box2, galleryInfo = featured2
prevTop = box3, galleryInfo = featured3
and so on...
I want the description to change when the image changes. I think i need to use some sort of function() or eval(), but i'm not too familiar with how these tags work...
My actionscript knowledge is somewhat limited, but i'm trying to learn and understand how to set these things up. It seems like it should be fairly simple, but I haven't been able to figure it out yet.
Any help would be greatly appreciated.
Thanks,
Deanna
Dynamic Text Variables
i'm looking for help working with dynamic text fields and variables taken from external .txt files.
one .txt file, multiple variables... no problem... but for some reason I have yet to be able to get multiple files to import multiple variables... say, for 2 .txt files: test1.txt & test2.txt
loadVariablesNum("test1.txt", 0);
loadVariablesNum("test2.txt", 0);
this seems to make flash very angry at me and I would like to make amends with my program.
Thanx!
Getting Variables From Dynamic Text
A simple input text field at the end of Scene1 then displays the user name in Scene2. How do i detect if they have filled the feild in or not, if they don't I want the resulting text be different.
Any ideas?
Getting Variables From Dynamic Text
A simple input text field at the end of Scene1 then displays the user name in Scene2. How do i detect if they have filled the feild in or not, if they don't I want the resulting text be different.
Any ideas?
Dynamic Text Variables
I am loading a TXT file into the root of the FLA movie. It has a variable that I need to use in the frame actionscript code. How do I pull the variable straight to the actionscript. I can already send it straight to the text field. But I want to use in the timeline first. Any ideas?
I'm using Flash MX 2004. Thanks.
Flv As A Banner : Avoiding Flv Reload On Page Reload
Hello.. I'm tring to create a looping sfw banner containig a looping playst of flv on my new website...
I think I understoode how to do that..
My biggest problem, is that I wish the flv avoid reloading every time that the page is changed..
I don't know if I ì ve been clear...
I'm sure that checking this page will help understanding the problem:
www.kurageart.eu
hope you can help!
thank you
Effects With Dynamic Text Variables
Has anyone worked with dynamic text variables? To get aliased text - but with fade in / out OR arrive / leave effects.
I get the problem that the text in my scroll boxes arrives suddenly and I'd like to have it move in (or be presented) slowly. Can anyone help?
A list of resources hmmm..
Re-setting Dynamic Text Box Variables..possible?
I have 2 dynamic text boxes receiving text from an HTML tag. The movie needs to be changed to loop 3 times, each with different text. One box uses the variable "header", the other "text".
Here's what I'm doing:
+ feeding in text via OBJECT and EMBED tags (header1=xxxx&content1=yyyy&header2=aaaa...etc) (6 vars in all)
+ init a loop on frame 1 to = 1
+ pushing all the vars imported into an array (for ease of use and tidyness) newsArray with 6 elements
+ then, killing the imported variables, header1=0 (to save memory)
+ on frame 2 I have a looper check (if loop > 3 then loop = 1)
+ also an if, else if statement to choose the news based on loop's value:
(pseudo-code) If loop==1 then header=newsArray[1], text=newsArray[2]
else if
loop==2 then header=newsArray[3], text=newsArray[4]
etc
It's not working though. Is there something I don't know? I am learning ActionScript as I go so it may be my fault. Can the value of a variable assigned to a dynamic text box be changed during a movie? Is it going to be easier to set the visible of boxes overlaid on each other?
TIA
Leon
Dynamic Text And Passing Variables
I am making a preloader. Size is 525 x 420
I have one movie clip with a rotating sphere -
I have another movie clip with a fill bar I made and
next to it is a text box (dynamic) with the variable set
to (percentloaded) -
I have placed both movies on the stage -
I am confused somewhat from here on out. I know that there needs to be some actionscript to tell the dynamic text box to display the variable (percentloaded) of the
_root I would imagine. Is this correct?
If so what is the correct actions, and do I apply them to the dynamic text box inside the movie clip or to the dynamic text box once the movie clip is dropped into the scene?
New To Arrays... And Variables... And Dynamic Text LOL
HOwdy it;s me again.
Argh, I have a stupid stupid but very frustrating problem!
I have a dynamic text box called: number.
I have declared number = 0;
I have two buttons. When I press one, I want the number in the text field to go up, when I press another, I want it to go down.
Easy! Got that to work fine!
But-
How do I get it to only cycle thru 0-9... whenever it gets to 9 it of course displays 10, and I have been trying tons of things to get it to STOP
(I tried an array, but then read I can't access an array thru my text box? Is there some step I can do in between??)
I could do the easy way and make the text field a MC instead with 10 frames... a number on each frame... but I want to learn more about variables and such instead. Thanks for any help you can give me!
Dynamic Variables Into Text Fields
I have been trying very hard to get some variables that have been loaded into a flashMX file to output to a dynamic text box.
I can see the variables in my output box but can't access them.
I used loadVars
Can anyone point me in the right direction.
PLEASE
Variables In Dynamic Text Fields
Hi all,
I have a scene into which I have dropped some instances of checkboxes.
Within each instance of checkbox (button1,2 etc) I assign the values "I am on" or "I am off" to the variable 'boxstatus' to reflect its condition.
On the main timeline I have a dynamic textbox with the variable _root.button1.boxstatus and this works fine.
What I want is another textbox on the same timeline to which I can put some text and add _root.button1.boxstatus.
I have tried to script as follows on a new layer in th emain timeline:-
Newtext = _root.button1.boxstatus + "extra text" It only shows "extra text" in the box.
Where am I going wrong?
Passing Dynamic Text Variables
I'm trying to pass Dynamic Text Variables from an external swf to a container MC within my main timeline.
Is this possible.
Can't get it to work.
I have established the variables in my external swf, and when viewed
as a stand alone everything works.
In my main timeline I perform the LoadMovie function to my target MC, but the only thing showing up is the background image I placed in the external swf - no text.
Is there a way to achieve this????
Variables And Dynamic Text Issues
I have a project in which I want users to login and be taken to a user-specific page by way of dynamically loaded .txt files. Basically, at the login page, the username is stored as a global variable and I was hoping that I could use this variable to load the text file of the same name:
Login: LASTNAME_firstname
The following page loads "LASTNAME_firstname.txt" into a dynamic text field.
I'm having trouble figuring out how to do it, or if it is even possible. Any suggestions would be helpful.
Also, I'm using php/mysql for the login process, would it be easier to just return the username var from the php file?
Thanks in advance.
Retrieving Variables In Dynamic Text
I have this button/image which changes the dynamic.text variable and takes me to a new scene.
this.onImagePress = function(the_ibox){
_root.dynamic.text="Stuff";
_root.gotoAndPlay("new scene");
}
This takes me to my new scene and changes the dynamic variable to = "stuff" but I don't know how retrieve the data in the dynamic text so I get this code to retrieve dynamic.text data.
img1.loadImage(dynamic.text+"/"+dynamic.text+" ("+(1)+")"+".jpg");
img2.loadImage(dynamic.text+"/"+dynamic.text+" ("+(2)+")"+".jpg");
img3.loadImage(dymamic.text+"/"+dynamic.text+" ("+(3)+")"+".jpg");
A simple question but obviously my know-how has a few gaps.
Thanks
Declaring Variables For Dynamic Text Box
Hello,
I am trying to declare variables to be displayed in a dynamic text box, but for some reason it isnt working, even though i have done this 100 times before
On first frame is this code
green_11.text = "Insurance Industry Knowledge";
green_12.text = "92%";
green_13.text = "82%";
green_14.text = "96%";
green_15.text = "72%";
trace("green_11 - " + green_11);
later in the time line, inside a movie clip i have a dynamic text box with an instance name of green_11 it wont display..
my trace wont display either... it will if i remove the .text, but the text box still wont work
Multiple Variables And Dynamic Text...
hi, I've got a movie and everything works fine, but I'm trying to simplify it using variables.
On the stage I have 10 lines of dynamic text, which I want to manually input the required ID numbers. (var pos1 to pos10)
I also have another dynamic text variable which is automatically imported via an xml document (artistID)
At the moment I am running this script to see if the variables match up
Code:
var ID = _root.artistID;
//10
if (ID == 1693) {
_root.gotoAndStop("p10");
}
//9
else if (ID == 2116) {
_root.gotoAndStop("p9");
}
//8
else if (ID == 2627) {
_root.gotoAndStop("p8");
}
etc.......
but this means that I have to input the number twice and is quite time consuming...
How can I rewrite this code using 'if ID == variable10 etc' - this is confusing me and I know that the answer is staring me in the face...
Thanks for any help in advance
Rob
Defining Variables By Dynamic Text
I wanted to see if anyone had thoughts on this:
It's pretty basic to define a dynamic text by a variable, but what about the other way around?
I'm creating a SWF widget for kids who've most likely barely touched Flash (let alone AS), and want them to create a variable out of their name.
I'd like, though, to avoid having them futzing about in the actionscript editing window (since this project isn't a flash tutorial), so I've placed a line of dynamic text on the stage that says "Enter your name here" and gave it the instance name "myName".
Then in the actionscript, I've placed:
code: _global.nameX = myName.text;
In theory, all they have to do is open flash, change the name, and publish to create a SWF that generates their name as the "_global.nameX" variable.
This doesn't seem to work, though.
I know, I know, I might as well tell the kids to enter their name in the actionscript, but I thought this'd be a novel approach to user-friendliness.
Thoughts?
gyz
[CS3] Dynamic Text And Global Variables
I've been making an interactive map for a game, and I made it so that as you click on a town, a popup appears naming the city and the players with companies in the city. The popup consists of 2 movieclips which gain visibility when a city is clicked - one is simply the body of the popup - the frame and the color, slightly transparent, nothing fancy, while the other one consists of some static text and 2 dynamic text fields.
The dynamic text fields use global variables which change when a city is clicked (the invisible button redefines them). This means the popup should appear with the text defined by the clicked button. The variables are emptied again as a user closes the popup.
However, this does not happen. When a popup is spawned, the variables seem empty, there is no text. If, however, while the popup is opened, I look at the variables through the debugger, they're fine and changed accordingly. Also, when the popup is closed again, a look at the variables shows them as empty, as it should be. They just don't refresh "live" in the dynamic text fields... help?
Hope I managed to explain properly...
Dynamic Text/variables Problem
Hi,
I am new to this forum. I've tried experimenting dynamic texts and I've found some problems which I don't understand. I've attached the fla file with two movieclips, one have a blue square and dynamic text (var set to 'coins'). And the other movieclip have a yellow square and dynamic text (var set to 'coins').
Both clips are named 'score'. The blue clip is placed on frame 5 and 'score.coins' is set to 2, and yellow one is placed on frame 6 and 'score.coins' is set to 3. Both clips are on the same layer and I swap it to depth 100 when it is loaded.
When I run the test, I've found that score.coins remains 2 but the both dynamic text box shows 3.
Code:
frame = 2: score.coins =
frame = 3: score.coins =
frame = 4: score.coins =
frame = 5: score.coins =
frame = 6: score.coins =
frame = 6: score.coins = 2
frame = 6: score.coins = 2
frame = 6: score.coins = 2
It is confusing that I've set score.coins to 3 but the trace shows 2. I could find an explanation to this behaviour.
I've attached the fla file.
Thanks in advance.
Tony.
Tony.
Can't Set Dynamic Text Using Variables Within Path...
I have a bunch of dynamic text boxes called date0_txt + date02_txt, date1_txt + date12_txt, and im trying to put the text in using the following xml stuff, but nothing comes up in the text boxes. If I set it without the [] variable in the path, it works fine..any ideas? The XML is working, for sure.
ActionScript Code:
//this does not work
this["date"+numz+"_txt.text"] = tourInput.Tour.datez.text()[numz] + " " + tourInput.Tour.showtime.text()[numz];
this["date"+numz+"2_txt.text"] = tourInput.Tour.city.text()[numz];
numz++
ActionScript Code:
//this does work
date0_txt = tourInput.Tour.datez.text()[numz] + " " + tourInput.Tour.showtime.text()[numz];
date02_txt = tourInput.Tour.city.text()[numz];
numz++
Dynamic Text Variables Lost
Can someone tell me if there is anything I can do to maintain the dynamic text variables within my buttonclips when I do a gotoAndStop in this sample FLA.
Currently, the FLA works, because I am using:
PHP Code:
label = this.label_txt.text;
this.gotoAndStop("Down");
this.label_txt.text = label;
to restore the dynamic text value, but this seems silly to me! Also, when I try to goto the 'Hit' frame once and continue onto the 'Up' frame in the OnRelease() method, I lose the dynamic text (this is commented out in the FLA)
NOTE: The actionscript for the movieclip button is in the first frame of the Actions layer of tab_mc
Iterate Through All Dynamic Text Variables
Hello,
I'd like to be able to iterate through all of the dynamic text variables in my flash movie, and I'd like it so that if I add new text to this movie, it will show up in the iteration.
Essentially, I want to do something like this:
for (i in _root) {
trace(i);
}
While this seems to print out all the variables in root, it prints more than just the dynamic text variables, and also doesn't iterate down through various objects to find the dynamic text variable.
Is there any way I can accomplish this in action script?
Thanks!
Dynamic Text Link To Variables
I would like to have my dynamic text work like a calculator, just doing simple addition. I would like to add a variable (still thinking about this) to each item, and so that when each item is dropped onto the target the dynamic text is able to add them up. Its for a flash demo using weight on a scale and I am just lost in trying to figure this one out.
So I have shapes which I would like to somehow apply a variable to. When these shapes are dragged onto the "scale" target I would like the dynamic text box to reflect the addition process each time one shape is dropped.
Question About Dynamic Text Variables
I am having problem in the last line of code, where I try to call each textField by its instance name and set a variable name according to the changing value of I. When I try to test the movie I have an AS error poiting at the way I wrote ["pos"+i].variable="letter"+i;
I feel like its an easy one but its 3:17 and my brain is telling me to go to sleep so I hope someone out there can help me.
// Declare array with a list of words
words=["eat","sleep","run","jump"];
wordToGuess=words[Math.round(Math.random()*(words.length))];
trace(wordToGuess);
//Create as many TextBox as the number of letter in the chosen word
for(i=0;i>=words.length;i++){
_root.createTextField("pos"+i,10+i,55+(10*i),92,20 ,20);
_root.moveTo(55+(10*i),92);
_root.lineTo(55+(10*i)+30,92);
["pos"+i].variable="letter"+i;
}
|