Problem - Creating Dynamic Var Name From XML
Hi there.Here's my simple XML file:<?xml version="1.0" encoding="UTF-8"?><vars><var varName="speed" varValue="15" /><var varName="velocity" varValue="8" /><var varName="gravity" varValue="9" /></vars>I need to dynamically create a variable named (varName) and assign (varValue) as its value, accomplishing the following:speed = 15;velocity = 8;gravity = 9; However I am having trouble to evaluate the varName while creating the var within the loop:var XMLvars:XML = new XML();XMLvars.onLoad = function(success:Boolean) { if (success) { var getVars:Array = this.firstChild.childNodes; for (var i=0; i < getVars.length; i++) { // here's what I'm looking for: getVars.attributes.varName = getVars.attributes.varValue; } } }XMLvars.ignoreWhite = true;XMLvars.load("gameVars.xml"); Anyone to help????thanks in Advance,AunStudio team.
Adobe > ActionScript 1 and 2
Posted on: 08/02/2008 08:05:58 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Creating Dynamic Links Inside Of Dynamic Menus
hello, I am having a problem adding links dynamically inside of a menu that was created dynamically. Look here to see the movie. All of the menus are created dynamically with a for loop iterating through an array. As each menu is created I want the links to be created also. For this i have used nested for loops. My problem is labeling the link text. Here is all of my code.
code:
stop();
function default_location(){
topX = 10;
topY = 5;
bottomX = 10;
bottomY = 590;
bar._x = topX;
bar._y = topY;
}
default_location();
//number of menus
var numMenus = 6;
var menuTop = new Array();
var locationY = 5;
var locationX = 10;
//define the menu headings
var top0 = "New Home Buyer Program";
var top1 = "Franchise Opportunities";
var top2 = "Broker/Realtor Program";
var top3 = "Mortgage Broker Program";
var top4 = "Home Builder Program";
var top5 = "Company Info";
var menu0 = new Array();
//New Home Buyer Program Menu Items
menu0[0] = ["Get the Home of Your Choice Now", "www.nhba.com"];
menu0[1] = ["The NHBA Application Process", "www.nhba.com"];
menu0[2] = ["Find an Office", "www.nhba.com"];
menu0[3] = ["Complete an Application", "www.nhba.com"];
menu0[4] = ["Check the Status of Your Application", "www.nhba.com"];
menu0[5] = ["Available Property Specials", "www.nhba.com"];
//Franchise Opportunity Menu Items
var menu1 = new Array();
menu1[0] = ["The NHBA Franchise Experience", "www.nhba.com"];
menu1[1] = ["NHBA for the Franchisee", "www.nhba.com"];
menu1[2] = ["Exclusive Tools and Technology", "www.nhba.com"];
menu1[3] = ["FAQ's/Resources", "www.nhba.com"];
menu1[4] = ["Franchise Facts", "www.nhba.com"];
menu1[5] = ["Discovery Days Registration", "www.nhba.com"];
menu1[6] = ["Franchise Testamonials", "www.nhba.com"];
menu1[7] = ["Apply to be a Franchsie", "www.nhba.com"];
//Broker/Realtor Program Menu Items
var menu2 = new Array();
menu2[0] = ["What Brokers & Realtors Need to Know", "www.nhba.com"];
menu2[1] = ["NHBA for the Realtor", "www.nhba.com"];
menu2[2] = ["Request Information", "www.nhba.com"];
//Mortgage Broker Program Menu Items
var menu3 = new Array();
menu3[0] = ["What Mortgage Brokers Need to Know", "www.nhba.com"];
menu3[1] = ["NHBA for the Mortgage Broker", "www.nhba.com"];
menu3[2] = ["Request Information", "www.nhba.com"];
//Home Builder Program Menu Items
var menu4 = new Array();
menu4[0] = ["What Homebuilders Need to Know", "www.nhba.com"];
menu4[1] = ["How Lease-to-Own Works for You", "www.nhba.com"];
menu4[2] = ["Request Information", "www.nhba.com"];
//NHBA Company Info Menu Items
var menu5 = new Array();
menu5[0] = ["Company Overview", "www.nhba.com"];
menu5[1] = ["Contact Us", "www.nhba.com"];
menu5[2] = ["Management Team", "www.nhba.com"];
menu5[3] = ["Corporate Media Kit", "www.nhba.com"];
menu5[4] = ["What People are Saying", "www.nhba.com"];
menu5[5] = ["Pride in Partnership", "www.nhba.com"];
menu5[6] = ["Privacy & Security Policies", "www.nhba.com"];
menu5[7] = ["Site Map", "www.nhba.com"];
var numMenusLeft = numMenus;
//Create the Menus
for(i=0; i < numMenus; i++){
bar.duplicateMovieClip("bar"+(i), i+1);
_root["bar"+(i)]._y = locationY; //sets the initial location
locationBottom = bottomY - (28*numMenusLeft);//sets the bottom location
menuTop[i] = [locationY,locationBottom,_root["top"+(i)]];//assigns the menuTop array with the instance info
_root["bar"+(i)].menuName_txt = menuTop[i][2];
_root["bar"+(i)].name = "bar"+(i);
_root["bar"+(i)].id = i; //assigned id as array index (id = 0, 1, 2....)
_root["bar"+(i)].up = true;
locationY += 28; //increment locations for next menu
numMenusLeft-=1;
var len = _root["menu"+(i)].length;
//trace(len);
var linkY = 45;
var obj = new Array();
x = i;
for (j=0; j<len; j++){
//THIS IS THE PART THAT IS NOT WORKING
obj[j] = _root["bar"+(i)].link.duplicateMovieClip("link"+(j), j);
//_root["bar"+(i)].createEmptyMovieClip("mc"+j, j);
//["mc"+(j)].createTextField("txt", j, 0, linkY, 130, 40);
trace(obj[j]);
//IT DOESNT ASSIGN THE TEXT TO THE LINK
obj[j].link_button.link_text.text = _root["menu"+(i)][j][0];
obj[j]._y = linkY;
linkY += 30;
}
_root["bar"+(i)].link._visible = false;
//trace(obj.length);
for (k=0; k<obj.length; k++){
trace("Link:"+k+obj[k]);
}
}
_root.bar._visible = false;
function moveMenus(button_id){ //button id is coming in as the array index (0,1,2...)
//loop through all of the menus
for (i=0;i<=(menuTop.length - 1); i++){
if(i<button_id){
if (_root["bar"+(i)].up == false){
easeUp(i)}
}else if(i == button_id){
if (_root["bar"+(i)].up == false){
easeUp(i)}
}else if (i>button_id){
if (_root["bar"+(i)].up == true){
easeDown(i)}
}
}
}
/*This is how to use the MX easing tween:
var tabUp = new mx.transitions.Tween(movieClip, "_y", mx.transitions.easing.Bounce.easeOut, beginCordinate, endCordinate, time);
*/
function easeUp(menu) {
var tabUp = new mx.transitions.Tween(_root["bar"+(menu)], "_y", mx.transitions.easing.Strong.easeOut, menuTop[menu][1], menuTop[menu][0], 12);
_root["bar"+(menu)].up = true;
}
function easeDown(menu) {
var tabUp = new mx.transitions.Tween(_root["bar"+(menu)], "_y", mx.transitions.easing.Strong.easeOut, menuTop[menu][0], menuTop[menu][1], 24);
_root["bar"+(menu)].up = false;
}
Any help would be MUCH appreciated.
Looping Over Dynamic Variables And Creating Dynamic Mcs
Hello. I have a flash app I'm working on where I'm loading in content from an xml file, then dynamically creating mcs to create an mc for each item in the xml results. Then loading images in to the mcs.
If I don't do a loop and just do it manually, repeating every command but just changing the name of the mcs and variables.. it works.
But when I try to loop over it, its not displaying the mcs. I get no error message. And I've stepped through the code and can't see where its going wrong.
Below is the as for the looping movie that isn't working. If you need me to I can post the as for the non-looping movie if it would help see what I'm doing wrong.
Code:
//---------------------------
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("fplayer_data.xml");
/////////////////////////////////////
p = 0;
dCounter = 1;
this.onEnterFrame = function() {
for(i=0; i < 4; i++) {
picture0.duplicateMovieClip("picture" + dCounter, dCounter);
this[picture + dCounter]._x = this[picture + i]._x + 55;
filesize = picture0.getBytesTotal();
loaded = picture0.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (this[picture add i]._alpha<100) {
this[picture add i]._alpha += 10;
}
}
dCounter++;
}
};
function firstImage() {
for(j=0; j < 4; j++) {
if (loaded == filesize) {
this[picture add j]._alpha = 0;
this[picture add j].loadMovie(image[j], 1);
this[desc_txt add j].text = description[j];
}
}
}
Creating Dynamic Buttons With Dynamic Behaviours...
Hi!
I am creating dynamic buttons with a instruccion like this:
Code:
for (i=0; i<25; i++) {
_root['room'+i+'_btn'].onRollOver = function() {
trace ("color:"+i)
};
I want every button says a different number. ej: if u push the button 12 (i=12) it says "color:12"
With the code i created it always says "color:24"
any idea???
Thanks!!
Creating Dynamic Text Fields Within Dynamic Mc
Im using this xml "data.xml":
HTML Code:
<XML>
<salesreps>
<rep>
<firstname value="Jon"/>
<lastname value="Doe"/>
<phone value="(555)999-9999"/>
<email value="jondoe@yahoo.com"/>
<description value="Description for Jon Doe."/>
<photo value="../LandAm/images/wes.bmp"/>
</rep>
<rep>
<firstname value="Jane"/>
<lastname value="Doe"/>
<phone value="(555)555-5555"/>
<email value="janedoe@yahoo.com"/>
<description value="Description for Jane Doe."/>
<photo value="../LandAm/images/robin.jpg"/>
</rep>
<rep>
<firstname value="adfkljasdfl;kj"/>
<lastname value="l;kajglaskdj"/>
<phone value="kdfjgls;dkjg"/>
<email value="dfgkljsdlg;"/>
<description value="kjdgfl;asdkgnl;sakdnglkj"/>
<photo value="../LandAm/images/nophoto.jpg"/>
</rep>
</salesreps>
</XML>
I want to generate a mc for each rep with 6 text fields containg the 6 values for eash rep. So for this xml there would be 3 mc's with 6 text fields in each. This is one of my first times really diving in to xml parsing in Flash.
I just need a push in the right direction. Thank you for you time!
Creating Dynamic Tooltip For Dynamic Text
I've been working on a proof of concept and have run into a stumper. What I am trying to do is add tooltips dynamically to dynamic text. Here is what I have so far, http://www.hallmedia.com/client/chop/tooltip.swf
Type in some text including the magic word "dolor" and hit the orange button. Flash will highlight the first instance of dolor wherever it might be in your text. Groovy.
Now I am trying to figure out a way to get the coordinates of the first and last character so I can attach a movie clip covering that area that will invoke a tooltip popup upon rollover. Any ideas?
Help Creating Dynamic Nav From XML
Hi all,
Question:
I would like to create a Dynamic Nav scroller at the top of my page. I have an XML file in this format:
Code:
<Catalog>
<Pages>
<Page>
<JpgUrl>/images/01.sm.jpg</JpgUrl>
<ZoomJpgUrl>/images/01.lg.jpg</ZoomJpgUrl>
<TextArea01>Front Cover</TextArea01>
</Page>
<Page>
<JpgUrl>/images/02.sm.jpg</JpgUrl>
<ZoomJpgUrl>/images/02.lg.jpg</ZoomJpgUrl>
<TextArea01>02-03</TextArea01>
</Page>
<Page>
<JpgUrl>/images/03.sm.jpg</JpgUrl>
<ZoomJpgUrl>/images/03.lg.jpg</ZoomJpgUrl>
<TextArea01>04-05</TextArea01>
</Page>
.
.
.
</Pages>
</Catalog>
What I would like to do is this: I need to display the <TextArea01> node as Dynamic Text which will act as a Nav Link in a scrollable pane as such:
Nav example -
<< Front Cover 02-03 04-05 06-07 08-09 10-11....>>
How do I begin to create this Nav area? How do I loop throught the document and have it create the Nav on the fly, based on the number of childs present?
Here's another example of what I'm trying to achieve:
http://www.spiegel.com/RichFXCatalog.../301/index.asp
(View the scrollable nav at the top of the flash piece.)
Help Creating Dynamic Nav From XML
Hi all,
Question:
I would like to create a Dynamic Nav scroller at the top of my page. I have an XML file in this format:
Code:
<Catalog>
<Pages>
<Page>
<JpgUrl>/images/01.sm.jpg</JpgUrl>
<ZoomJpgUrl>images/01.lg.jpg</ZoomJpgUrl>
<TextArea01>Front Cover</TextArea01>
</Page>
<Page>
<JpgUrl>/images/02.sm.jpg</JpgUrl>
<ZoomJpgUrl>images/02.lg.jpg</ZoomJpgUrl>
<TextArea01>02-03</TextArea01>
</Page>
<Page>
<JpgUrl>/images/03.sm.jpg</JpgUrl>
<ZoomJpgUrl>images/03.lg.jpg</ZoomJpgUrl>
<TextArea01>04-05</TextArea01>
</Page>
.
.
.
</Pages>
</Catalog>
What I would like to do is this: I need to display the <TextArea01> node as Dynamic Text which will act as a Nav Link in a scrollable pane as such:
Nav example -
<< Front Cover 02-03 04-05 06-07 08-09 10-11....>>
How do I begin to create this Nav area? How do I loop throught the document and have it create the Nav on the fly, based on the number of childs present?
Here's another example of what I'm trying to achieve:
http://www.spiegel.com/RichFXCatalog.../301/index.asp
(View the scrollable nav at the top of the flash piece.)
Creating A Dynamic Tip Of The Day
Does anyone know of a tutorial that shows me how to add a tip of the day section in flash that uses XML to my website. Any help will be greatly appreciated. Thanks.
Creating Dynamic Xml
The help files give an example like this to convert a sting to xml
PHP Code:
var xml:XML = <p>hello</p>;trace(xml); // hellotrace(xml.toXMLString()); // <p>hello</p>
However I need it to be dynamic and more like this:
PHP Code:
var newXml:XML =for (var i:int=0;i<oldXmlList.length(); i++) { <books id=" + oldXmlList[i].@id + " value=" + sliderValues[i].value + " />") }
Im obviously doing something wrong. Does anyone knoe the correct methods and syntax I need to use here?
Creating Dynamic Objects
Hello ,
I need help from experienced people...
I want to create a movie which will dynamically create objects on the fly.
Once these objects are created, then I should be able to access these objects and change certain properties for them.
The type of objects that I would like to create are ..
a movie clip... static text... dynamic text... buttons.....
all types of objects
.... at this point I would like to ask a question
IS it possible to copy something to the clipboard and then paste the clipboard contents in the flash movie that is playing...
i.e again creating a new object with the copy--paste method...
I don't know whether things like this are possible... If possible then I would appreciate some guidance in achieving the results.
Thanks in advance
Creating A Dynamic Counter
Greetings,
I am up against a little problem in developing a simple Flash animation. I want to create a counter that continually couts up as the entire counter slowly moves in the positive y direction. I initially created the swf from an After Effects movie (using the text>numbers filter) and the effect worked great. However, AE rasterized all the frames and the file turned out to be almost 2GB!! I know that there has got to be a better way. Does anyone know of a way to create an increasing counter like in AE? I would especially like to count in 30fps timecode. Thanks for all the help.
Creating Dynamic Scheduling App
I want to create a flash app that allows members in my department to schedule events. I have seen the Macromedia Demo for the Trio Motors extranet and this is very similar to what I want. I just need a good resource to aid in the planning and development of this project. I need this to be database driven and easy to update and manage. (I plan on using coldfusion)
Anyone that can point me in the right direction would be very helpful.
Thanks for any advice or recommendations!!
Creating A Dynamic List Box...
how do i go about creating something like this without using one of the mx components? just a scrollable text box that i can insert text links into dynamically, maybe with the load variables from a txt file function... would i create some sort of array for this? im lost.
example:
---------------
www.link1.com
www.link2.com
www.link3.com
---------------
scroll up / down
any ideas or direction is greatly appreciated.
Creating Dynamic Functions
hello, hello,
I'm creating a menu of sorts using createTextField and createEmptyMovieClip. I'd like to create dynamic funtions for each of the EmptyMovieClips.
Here's the code
count = 0;
//subNum = Var from ASP page (number of records in DB)
while (count<this.subNum) {
// Create right number of text fields based on VAR from asp page & DB
this.createTextField("sub"+count, count,count*20,count*30,100,20);
this["sub"+count].type="dynamic";
this["sub"+count].border=true;
this["sub"+count].background=true;
this["sub"+count].backgroundColor=0xffffff
this["sub"+count].password=false;
this["sub"+count].multiline=false;
this["sub"+count].html=false;
this["sub"+count].embedFonts=false;
this["sub"+count].variable="fld"+count;
trace(this["sub"+count].variable);
this["sub"+count].maxChars=20;
// Create buttons from text fields
_root.createEmptyMovieClip("button"+count, 100+count);
_root["button"+count].lineStyle(1, 0x000000, 100);
_root["button"+count].beginFill(0xFF0000, 50);
_root["button"+count].moveTo(0, 0);
_root["button"+count].lineTo(100, 0);
_root["button"+count].lineTo(100, 20);
_root["button"+count].lineTo(0, 20);
_root["button"+count].endFill(0, 0);
_root["button"+count]._x=count*20;
_root["button"+count]._y=count*30;
_root["button"+count].onRelease=function(){
trace("something "+count);
}
count += 1;
}
------
What I tried was _root["button"+count].onRelease=function(){
trace("button"+count);
}
The problem is that all the buttons are tied into this one function, it doesn't create a new 1 for each new sybmol it creates.
Does anyone have any ideas on how I could create a function of each new symbol on the fly?
thanks,
- J
Creating Textboxes Dynamic
This can be done but how in the h... do you write to them dynamically?
I dont know how many I want and what to write to them untill I get there!
Any help would be much aprreciated!
Here is my suggest. but does not work since flash mx does not accept line 4!
1 for (i = 0; i < someNumber; i++) {
2 name = "mytext" + i;
3 _root.createTextField(name, 1 , 50, 50, 200, 100);
4 name.text = "hello"+i;
5 }
Pls help
Thx in advance
HELP PLEASE Creating Dynamic Buttons
I'm sure I'm missing something simple here...I have a text file (buttondata.text) and I'm trying my best to create dynamic buttons based on the fields in the file. It's a simple listing of employees and their respective titles. I am DESPERATE to solve this simple issue, so if anyone could look at the attached zip containing my FLA and my txt file, and let me know what's wrong, I would be really appreciate it.
the text file buttondata.txt contains the following:
label0=John<br>Director&link0=xyz&label1=Mark<br>I T Manager&link1=abc&count=2&
Creating A Dynamic Menubar
It's kinda hard to explain...
I need to create a dynamic scroll/menubar.
Imagine that I have a 20 page presentation, so I need a menubar with buttons targeting all pages from page 1 do 20, if I have 40 pages, from 1 to 40.
Something like that...
Even if you don'y understand what I am trying to say I just need to know How to create a button via ActionScript (design, size, hyperlink, etc.), in this case... a hole bunch of them... but I guess knowing how to create more than one button it's just a case of Do "Create button" while "number of already created buttons" = "number of maximium buttons", and of course, each button must have it's own XY coordenates and hyperlink.
Any ideas?
Thanks in advance :-)
EDIT: I've been observing some of the Samples that Flash 5 has to offer and I came across this "Duplicate Movie Clip" lesson, It's just what I needed! It's not C++ but It will just have to do...
If someone thinks that he/she has something usefull to add, please do!
Creating A 'dynamic' Button
Hey Everyone!
My problem is simple - the answer may not be...
I am creating a radio/mp3 player for my website.
I have gotten the playlist and files working fine (thanks to the ownderful people here at FK)
My problem is this - In the fields that list the Title/Artist/etc.. I want t ocreat a button.
A button in which when clicked on - will open up a popup - linking to the artists website.
I can create a standard button - but how (if it's possible) can i get the link to change with the corresponding song?
(IE) Title: My Favorite Song
Artist: A Great Band
i want the artist box to link to www.agreatband.com
then when the next song comes on
Title: A Song I've Never Heard
Artist: A Band I've Never Heard
with the artist link now pointing to www.abandiveneverheard.com
etc...
Any help is greatly appreciated - thanks in advance
_=RR=_
Creating Dynamic Menus
I 've been playing with popup menus all week, and thanks to the help of people on this board managed to create one and get it working. But now I'm getting greedy and trying to figure out how to create a dynamic one. I found an example fla (included below) that creates a menu from an array. However it only links to urls and not frames in the main movie. Can anyone help me out with this, I've tried to add an .onpress event to the button that is behind the text items of each menu item but this doesn't seem to work, tho I suspect this may be due to my lame coding .
I'm assuming that by removing the line:
Quote:
subMenu.sub_menu.link = subLink.split('#')[1]
I will get rid of the url link, however I need somehow to create an onpress (or other) event which will then let me move to another frame, so I tried:
Quote:
subMenu.onPress = function() {//on button press
_root.gotoAndStop(subMenu.sub_menu.txt);//goto frame in main scene
};
The idea being that the name of the menu item is also the name of the frame I wish to go to. However this doesn't seem to work.
I'd really appreciate any help or guidance.
Creating Dynamic Button
I have loaded few thumbnail images dynamically using CreateEmptyMovieClip. As I want all the images to be clickable I have used mc.onPress Command but I can't find different clickable buttons. Each button is going to the same target. I want to trace for the first button as "1" for the second button "2" for the third button "3" and so on. Please help me with the code. I have attached the files.
Creating Dynamic Actionscript?
hello,
i'm creating a form with multiple databound comboboxes using a loop like this:
// Start script
c=330;
for(z=1;z<9;z++){
_root.createObject("ComboBox", "select"+z+"_cb",z);
_root["select"+z+"_cb"].setSize(377,22);
_root["select"+z+"_cb"]._x=45;
_root["select"+z+"_cb"]._y=c;
import mx.data.binding.*;
var src = new EndPoint();
src.component = _root.data1_ds;
src.property = "dataProvider";
src.event = "release";
var dest= new EndPoint();
dest.component = _root["select"+z+"_cb"];
dest.property = "dataProvider";
new Binding(src, dest);
c=c+23; //used for spacing
}// End Script
This is working fine. Now I want to assign a dynamic onchange event to each newly created combobox. when i had them hard coded i just assigned actionscript to each combobox like this:
on(change){
newvar=1
}
.....and then for the second CB i would have:
on(change){
newvar=2
}
etc... etc...
My question is how can i assign that on(change) to each created combobox within the loop at the top of this post?
Thanks, Dave
Creating A Dynamic List
OK, I want to be able to load a list from a textfile, display it in a movieclip, and have each list entry, when clicked on, open up a jpg file...how would I (generally...no need to write out the code) go about doing this?
Creating A Dynamic Slideshow ?
Hi I know how to load jpgs dynamically, All I want is to use loaded jpgs as a photo slideshow, using only two buttons (Next and Previous) So what code goes for those buttons ?
Creating Dynamic Menus.
What I want to do is take an array of links and create a menu on the fly from it.
Basically, have a simple button, which displays the link text on it, and opens the link URL "onclick". Then create a new instance of it on the stage for each link in the array.
I would really appressiate it if someone could point me in the right direction!
Thanks,
Neil
Creating Dynamic Photogallery Help
Hi there
I must make a nice photogallery in flash. I don't know totally actionscript. I nicely ask you for help me to make it - I wonna photogallery which is at this side
I need "only" ;D actionscript to move movieclip with cursor ( like it is featured in this above example )
My e-mail: matthew.makimo@gmail.com
You are my sheet-anchor
Regards
Matthew
ad. 1 some people who attentively read this text know now that I don't need help because i requested for make full (optionaly) photogallery ( i think that all of this example was maded by action script - no motion guide. What I expect from this post ? 3 answer : 1. This all photo on example are in one movie clip ? 2. How move with cursor movieclip in reverse ? 3. How make global point or line to tell cursor that it is at left side and right side. THX
Help Creating Dynamic Variables
I am trying to create a system that does reads a random variable from a text file and I need help. I have this basically:
I created a php file to get the listing of a directory. It takes each file and writes it to a text file like so:
&file1=blah1&file2=blah2&file3=blah3...etc...etc.. .etc
I then set up a Flash movie to read these variables. This part works fine. I can trace file1 and "blah1" will be displayed.
Now I have set up the following code to take a random variable from the text file:
fileNumber = Math.round (Math.random ()*16 + 1); //17 variables in the file
loadFile = "file" + String(fileNumber);
It all works ok. If I trace thisFile, I recieve "file5" (if 5 happens to be the random number). But I need to set it up so that when I trace loadFile I recieve "blah5" (again, if 5 happens to be the random number).
So my basic question is...How can I read a variable from a variable?
And...I'm kinda new to AcitionScripting so if I'm way off, please don't laugh.
Creating Dynamic MP3 Jukebox?
Hi, I am currently developing a music site
that intends to load MP3s dynamically
At the moment, my home screen's (Main SWF) library
is top-heavy with MP3s (I have 16 (20-second) song clips) )
I am trying to only add to the file size "One Song At A Time"
when the User presses a Button to each corresponding MP3 song
As well, I need a Playback control (Play-Pause-Rewind) for each
Song, and ActionScript that will know to automatically STOP each
MP3 if either
1) A New MP3 is selected to Play
or
2) A New home screen (Main SWF) button is pressed
This website protoptype is at
http://www.sweetybomb.com
and the music area is accessed via
the "m" in the "sweetybomb" logo UI
thanks
Help Creating Dynamic Variable
im using a third party extension to generate pdfs and
in order to use it, the following myPDF variable must be defined...
Code:
var myPDF:com.artificialcolors.blazePDF_Standard;
i need to generate many pdfs and would like this be dynamic, for example
Code:
xyz = '1';
var ['myPDF'+xyz]:com.artificialcolors.blazePDF_Standard;
i know this code is not valid actionscript.
how can i make this dynamic ??? what is the correct syntax ?
[CS3] Creating A PDF With Dynamic Text
Thank you for your interest.
I need to know if there is a way to have a button ( lets name it "View as PDF") when clicked it will grab the information of the dynamic text in my flash movie and create a PDF on the fly to be downloaded.
In short, have a button, when clicked, dynamic text is pulled from the timeframe/movie then produces a PDF that will download.
...creating Dynamic Graph...
hello
hope all you wiil fine and doing very well i am flash animator now i need to make bar graph which will get x, y vlaue from database and will create graph on x, y positiion.
Please any one let me know how i can make possible that.
Thanks
Creating A Variable With A Dynamic Name
Hey,
I've got to have this website finished by a deadline(tonight), and I need to know, how(if its possible) do you create a dynamic variable name? Like, for example, I pass the the parameter "which" to the function "createVar" which creates a loadVars object :
Code:
function createVar(which) {
var whichData:LoadVars = new LoadVars(); // This is the line I'm stuck with
}
createVar("test");
What I get is an object named : whichData
I wan't an object named : testData
How do I do this? I tried wrapping "which" with []([which]), I tried :
[which + "Data"]. But no go.
Creating Dynamic Object
I need to create an actionscript object dynamically where the name of the object is created based on user input. I have the following code which works but it requires I name the object in actionscript.
var ObjLabel:String = "Rice";
var ObjData:String = "$1.23";
var myObject:Object = new Object();
myObject[ObjLabel] = ObjData;
This works. If I enter:
trace(myObject.Rice);
it produces - $1.23
But I need to create the name of the object dynamically. Instead of using an object name such as "myObject" I would dynamically link (somehow) to the name entered by the client.
Dynamic Creating Of Cue Points.
Hi guys,
Did a quick search but come up with little info.
Is it possible to create flv cuepoints in a stream being recorded from a webcam?
At present i am able to record and pause the recording of the stream.
I was wondering when the recording is paused if it would be possible to make this a cue flv point so i will be able to trigger it later.
Thanks
Creating A Dynamic Button Using New
Hi
New to Flash+AS here.
To create a button dynamically, I tried all sorts of things and finally searched & found out that
PHP Code:
this.attachMovie("Button", "btn", this.getNextHighestDepth());btn.label = "a";
did the job.
Is there no way to get this working starting from
PHP Code:
var b:Button = new Button();
?
Thanks
Help Creating Dynamic Thumbnails
I have a requirement to create dynamic thumbnails from any file given(Video, images,word document,PDF etc). I used the approach of creating a bitmapdata from the first frame and using it as a thumbnail but it is not working. I am using the bitmapdata.draw method but the files are not in another domain. They are all copied locally and exists in the same folder as the mxml.Is there anything wrong with this? Also is there any better way of doing this?
Creating Dynamic Variables
In as2 it was easy to create dynamic vars like
ActionScript Code:
for(var i:Number = 0; i < 10; i++){
_root["mc_" + i] = new MovieClip();
}
But now i'm stuck with this in as3, anyone who knows how to create this in
as3?
I've done the same just changed _root into root and i have this error:
ReferenceError: Error #1056: Cannot create property mc_0 on Main.
at Main()
Creating An Array With A Dynamic Name?
Hi, really struggling with this.
Say i have an array:
var myArray = ["cheese", "milk", "eggs"];
what i now want to do is loop through this array and create a new array for each element in myArray, so now i would have 4 arrays:
myArray:Array
cheese:Array
milk:Array
eggs:Array
i cant work out how to do it on the fly though, like
var this[myArray[i]]:Array = new Array();
do you see what im getting at? Its in a class if that makes any difference
help much appreciated!
Cheers, Neil
Help Creating Dynamic Equalizer
Hi everyone,
Need help creating an equalizer. I don't even know where to start to create this thing. I know that I want to use actionscript to create random heights. I need to also turn the music on and off, and when it is off the equalizer dosn't move and so on. Does anyone know of a tutorial on how to do this, or can anyone step me through how to do it.
Thank you.
Creating A Dynamic Portfolio
Hello everyone,
I am trying to set up a portfolio where an image loads only if the user selects the images thumbnail. A tutorial explained this very well. Unfortunately, my flash file uses variables to pass information.
Does anyone know how to make this code work using variables?
Here is the code that they recommend placing on the button:
click here to view tutorial
function portfolioLoader (image) {
main_mc.contentPath = image;
}
comp_but.onRelease = function (){
portfolioLoader("full/image1.jpg");
}
Here is the code attached to the current button that I use for my thumbnails:
on (release) {
if (_root.kk<>num and _root.gg == 0 and _root.link == 1 and _root.animation == 1) {
_root.pages001.pages.big_gallery.play();
_root.kk = num;
} else if (_root.link<>1 and _root.animation == 1) {
_root.animation = 0;
_root.menu["item"+_root.link].gotoAndPlay("s2");
_root.link = 1;
_root.kk = num;
_root.menu["item"+_root.link].gotoAndPlay("s1");
_root.pages001.play();
}
}
root.kk is the movie clip that contains the timeline for my large images.
Here is the URL of my website:
Premier Outdoor Solutions
Any help would be GREATLY appreciated!
SunsFan13
Dynamic MC Creating In For Loop
can someone please explain to me how I can create a movieclip, then create n children to the movieclip. In the following code, if i use 'this' instead of a mc id [matrix] then it works, but when i try to createEmptyMovieClip using matrix. the children are overwritten.
What I want to acheive is one movie clip with n children that i can move and all its children will move in unison, and another mc that sits in a static position above the moving clip.
thanks,
Maurice
Attach Code
// this code produces 9 clips but on the root level
for (var i = 0; i < 9; i++)
{
var mc = this.createEmptyMovieClip('clip_' + i, getNextHighestDepth());
}
// this code produces one clip inside the matrix clip
// what i want is 9 clips inside the matrix clip
matrix = this.createEmptyMovieClip('matrix', getNextHighestDepth());
for (var i = 0; i < 9; i++)
{
var mc = matrix.createEmptyMovieClip('clip_' + i, getNextHighestDepth());
}
Creating Dynamic Buttons-xml/php
I hope somebody can help me out;
I ve got a code which takes info (text and images out of a xml file that worls proper! Now what i want is this; There are multiple buttons which should me created automaticly when adding items. Also each button needs the same script to pull the (different) information out of the xml file. A php programmer takes care of the dynamicly created xml files.
Please help me out of this one....
My code sofar which works; (without buttons)
slides_xml = new XML();
slides_xml.onLoad = startSlideShow;
slides_xml.load("reports/paris.xml");
slides_xml.ignoreWhite = true;
//
// Show the first slide and intialize variables
function startSlideShow(success) {
if (success == true) {
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
updateSlide(firstSlideNode);
}
}
//
// Updates the current slide with new image and text
function updateSlide(newSlideNode) {
imagePath = newSlideNode.attributes.jpegURL;
loadMovie(imagePath, targetClip);
slideText = newSlideNode.firstChild.nodeValue;
}
//
// Event handler for 'Next slide' button
next_btn.onRelease = function() {
nextSlideNode = currentSlideNode.nextSibling;
if (nextSlideNode == null) {
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
updateSlide(firstSlideNode);
} else {
currentIndex++;
updateSlide(nextSlideNode);
currentSlideNode = nextSlideNode;
}
}
//
// Event handler for 'Previous slide' button
prev_btn.onRelease = function() {
previousSlideNode = currentSlideNode.previousSibling;
if (previousSlideNode == null) {
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
} else {
currentIndex--;
currentSlideNode = previousSlideNode;
updateSlide(previousSlideNode);
}
}
stop();
Creating Dynamic Graphs
could anybody help me to create a dynamic graph?
I have a frequency distribution table corresponding to which i have to create a histogram. The activity is that the graph shud show the corresponding variations once the frequency interval is changed..
Any help is highly appreciated.
Creating A Dynamic Site?
Hi, I'm completely new to this kind of stuff so please bare with me
I want to create a flash website with a front page that can be changed through a text document or something like that. Basically, you would be able to re-write the text from somewhere else and then the site will change accordingly. It would be even cooler if I can make like a Admin flash page and you could update it from there. Just anything that'll help me update without having to open flash everytime.
Can anyone point me in the right direction?
Creating Dynamic Buttons?
im trying to dynamically create buttons...here's an example scenario ->
off stage is a movie clip called "originalButton_mc"
I want to use a loop to duplicate this movie clip 25 times, and each one should be able to perform a unique onRelease function
ex.
Code:
for (i = 0; i<25; i++) {
var newButton_mc = originalButton_mc.duplicateMovieClip("button"+i, i+1);
newButton_mc._y = i*22;
newButton_mc._x = 10;
newButton_mc.onRelease = function() {
trace(i);
};
}
the problem with the above code is that when I click my new buttons it always traces 25...because, clearly - my code is wrong, and the onRelease is getting rewritten for each button - hence its left with the last i ... 25.
Any clues on how I should be doing this so it works right?
Creating Dynamic Vars
Hello,
I've got little problems to create dynamic variables and i'm looking everywhere for the right syntax, but i cannot get this code works :
public function drawStage(tBitmaps:Array){
var c0:Bitmap ;var c1:Bitmap ;var c2:Bitmap ;
//here i'd like to place a loop to create my c's dynamically
//but got some syntax problems i guess
var lng:int = 3;
for(var i:int=0;i<lng; i++){
this["c"+i]= new Bitmap( tBitmaps[i]);
//here it wont work, unless i wrote
//c0 = new Bitmap( tBitmaps[i]);
}
}
What's the main difference between c0 (working) and this["c"+0] (not working) ?
Creating Dynamic Buttons-xml/php
I hope somebody can help me out;
I ve got a code which takes info (text and images out of a xml file that worls proper! Now what i want is this; There are multiple buttons which should me created automaticly when adding items. Also each button needs the same script to pull the (different) information out of the xml file. A php programmer takes care of the dynamicly created xml files.
Please help me out of this one....
My code sofar which works; (without buttons)
slides_xml = new XML();
slides_xml.onLoad = startSlideShow;
slides_xml.load("reports/paris.xml");
slides_xml.ignoreWhite = true;
//
// Show the first slide and intialize variables
function startSlideShow(success) {
if (success == true) {
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
updateSlide(firstSlideNode);
}
}
//
// Updates the current slide with new image and text
function updateSlide(newSlideNode) {
imagePath = newSlideNode.attributes.jpegURL;
loadMovie(imagePath, targetClip);
slideText = newSlideNode.firstChild.nodeValue;
}
//
// Event handler for 'Next slide' button
next_btn.onRelease = function() {
nextSlideNode = currentSlideNode.nextSibling;
if (nextSlideNode == null) {
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
updateSlide(firstSlideNode);
} else {
currentIndex++;
updateSlide(nextSlideNode);
currentSlideNode = nextSlideNode;
}
}
//
// Event handler for 'Previous slide' button
prev_btn.onRelease = function() {
previousSlideNode = currentSlideNode.previousSibling;
if (previousSlideNode == null) {
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
} else {
currentIndex--;
currentSlideNode = previousSlideNode;
updateSlide(previousSlideNode);
}
}
stop();
Creating Dynamic Graphs
could anybody help me to create a dynamic graph?
I have a frequency distribution table corresponding to which i have to create a histogram. The activity is that the graph shud show the corresponding variations once the frequency interval is changed..
Any help is highly appreciated.
Creating A Dynamic MP3 Player.
Being a total AS n00b, I'm having trouble doing the following, even after hours and hours of tutorial browsing and Googling... :'(
I have a database which contains the paths to certain mp3 files. I'm using an ASP file to pass the variables to the SWF-movie by embedding the movie with the following code:
<EMBED src="mp3player.swf" FlashVars="<%= Server.URLEncode((rsPRODUCTS.Fields.Item("preview").Value)) %>"> </EMBED>
"preview" contains the path from the database to the mp3 file. The trouble I'm having concerns the actionscript part. I just can't seem to figure out how to get the variable "preview" into the actionscript. Basiccaly I'm trying to do the same thing as Creole tried to do in this thread:
http://www.sitepoint.com/forums/showthread.php?t=183758
Any help or leads to help me on the right track would be greatly appreciated!
Creating A Dynamic Map In Flash
Hi there
I need to create a floormap wich displays the layout of a ground floor of a shopping mall when you select a certain shop on this map it should display the information ie. shop name contact number etc..
I have no idea where to start. I dont even know what to do. I am very basic in flash is there any books that will be able to help me with this or tutorials that i can use
thanks
|