[FLMX04] Creating Multiple Variables From A Txt File
I am trying to create multiple variables from quite a big NOTEPAD / Txt file that would be constanly changing.The notepad file would look something along the lines of: Quote:
heading1=Hello!&heading2=How r u?&heading3=Great Day... ... &heading50=WOOT!!! etc.
I am trying to generate multiple variables in Flash MX 2004 for each of those "headings"In Flash I've tried things along the lines of: Quote:
loadTxt = new LoadVars();loadTxt.load("headings.txt");loadTxt.onLoad = function() { for (i=1; i<50; i++) { heading[i] = this.heading[i] }};
but the variables never seems to register (i make dynamic txt boxes and give them variable names like: heading1, heading 2 etc.).Also, the only reason I had "i<50" is because I don't know how to make the function stop looping when it gets to a heading that doesn't exist, so, um, how would you make it stop when it reaches a non-existent heading or the end of the text file?Thanks Heaps!
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 07-20-2006, 04:59 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
(flmx04) - Loading Variables From Data.txt ( Problem)
Hi,
I'm having a problem when loading variables from data.txt. Obviously, the & symbol is what states a new variable, but i'm having clients enter html text and the (for white space in html) sign comes up a lot and breaks the line of text. Is there a line of code in actionscript that I can input that states that whenever there is " ", for the flash to ignore it or just enter a space instead of looking for a new variable.
Thanks in advance,
Roy
Creating Multiple Variables Using A
Hey,
Hopefully someone has figured out how to do this...
It should be fairly simple.
I need to assign the numbers 1-30 to the variables b1 to b35 randomly.
basically I need to know how to use a for loop to create these variables.
maybe something like this:??
for (start = 0; start <= 30; start++){
b+start = start
}
except that I can't seem to get the variable name to randomly change.
maybe arrays??
HELP please!!
Creating Multiple Variables At Once?
Hi
Is it possible to create multiple variables at once?
I have the following code that I am using over and over, and rather than retype it each time, I am wondering if there's a way to put it inside a function, so that each variable is created on the fly.
Here's the code that I'm using now:
var menuName0LV:LoadVars = new LoadVars ();
menuName0LV.onLoad = function (success) {
if (success) {
menuLoader();
} else {
menu0_MC.textLabel.text = "error";
}
}
var menuName1LV:LoadVars = new LoadVars ();
menuName1LV.onLoad = function (success) {
if (success) {
menuLoader();
} else {
menu1_MC.textLabel.text = "error";
}
}
And so on. I create as many variables as I have movie clips for them-- anywhere from 1 to 25, say.
I tried calling and using the variables by putting them inside a function, and then calling the function, but it didn't seem to work--
menuArray_array = new Array();
function createVariables () {
for (g = 0; g < 5; g++) {
menuArray_array[g] = _root["menu" + g + "_MC"];
x = eval("menuName" + g + "LV");
var x:LoadVars = new LoadVars();
x.onLoad = function (success) {
if (success) {
menuLoader();
} else {
menuArray_array[g].textLabel.text = "error";
}
}
}
}
createVariables();
Any ideas?
Creating Multiple Variables Dynamically
Hello,
I've got a for loop creating x number of duplicate movies...that's all cool and happy. But I want to create x amount of variables on the main time line dynamically. I've set up a function on the main time line that is called each time the for loop does its thing...obviously it wont work as is...but how do I get something like this working?
code:
function createVars(amount) {
markerLocVar = "_root.marker"+amount+"loc";
markerXVar = "_root.marker"+amount;
eval(markerLocVar)= eval(markerLocVar)._x;
}
Say the amount of times this is called is 3 times. I would like 3 variables created by the code called and located:
code:
_root.marker0Loc;
_root.marker1Loc;
_root.marker2Loc;
any help would be great! Thanks!!
ss
Creating Multiple External Links For One SWF File
Hello,
Does anyone know how I can manually link my .swf banner to specified links without having to edit the actual .fla file each time creating a totally new banner?
Here is my problem in more detail:
I have a bunch of affiliates who use the same exact flash banner that I created, but they all have to link to a different URL. My problem is that, whenver I have to update the banner, I then need to change the .fla file, and then create about 100 new banners to replace the old banners... this it quite time consuming and very irritating!
I'm wondering if there is a way to just link a .swf file, the way anyone would by just adding a link to a .gif banner, ie:
<a href="http://www.linkname.com"><img src="imagefile.gif"></a>
is there a way i can do it like this:
<a href="http://www.linkname.com"><img src="imagefile.swf"></a>
i know this way does NOT work.. but is there some way like this that I can use to link the same banner to different URL's?
My goal is to have ONE .swf banner for ALL my affiliates... but each one to have its own link...
if anyone knows of a way this can be done, that would be great! Please let me know..
thanks
angelyssa
Variables From Txt File Creating Problems
Hi everyone
My prob is when I load variables from txt file into level
and if I tried to increment that it dosent work properly.
like:-
&played=1 is the value I am loading from txt file
Now if i tries to add by one,(1+1)
It shows me 11 instead of 2. Please help! Thanking u in advance.
Creating Controls For Multiple Movie Clips In One Flash File
I am a true beginner here! I would like to create one flash file that contains butons to manage stop/start 8 movie clips(at full screen)!! Where do I begin? I can create the buttons and actions for those but how do begin to mange the movie clips at full screen? Any suggestions? PLease help!!!
Multiple Variables In One .txt File
I was reading somewhere that you can have multiple variables in one .txt file. How does this work?
I tried _root.textbox.loadVarioables("text.txt","Variable1 ");
with the .txt file looking like this:
&Variable1= test
&Varibale2= test2
but It brought up nothing.
LOAD MULTIPLE VARIABLES FROM TXT FILE?
Is there a way to define multiple variables in a text file??
My txt file looks like this:
date01=11.20.01
bands01=Blah blah blah
venue01=Blah blah blah
info01=Poop
Only the date variable loads....can you load more than one in 1 text file????
All of my textfields are in the same location as the one that works and the names are spelled correctly...
Can I set up an array? If so, how does the syntax look?
[Edited by shreder540 on 11-20-2001 at 10:44 PM]
Multiple Variables In The Same Text File?
Is it possible to define and use more than one variable in a text file and have them load into 2 seperate dynamic text fields?
If so, how do you seperate them in the text file?
Multiple Variables In A Text File
Ok I have done this a hundred times...well maybe just 10 or so...but anyway, if you want to load in variables from a text file you can have multiple variablesin one text file. And..you seperate each variable with an & (ampersand).
Now, I have done this before where each variable is on its own line in the text file like so:
variable1=value
&variable2=value
&variable3=value
...and so on
I am using the LoadVars object to load in my text file like so:
Code:
variables = new LoadVars();
variables.load("text.txt");
//assign a function which fires when the data is loaded:
variables.onLoad = function(success) {
if (success) {
trace("done loading");
init(); // just to get things rolling once loaded
} else {
trace("not loaded");
}
};
First off can you not place variables on seperate lines in a text file (I have done it once with at least two variables)? And second, is my LoadVars object set up all squirrly?
The one fix I have found is to run all my variables in my text file together like the following:
variable=value&variable2=value&variable3=value...e tc
I just want it to be more readable like the above example.
Any help would be greatly appreciated!!
Load Multiple Variables From One Txt File
Hi!
I can't seem to find an answer for this...
I'd like to have one txt file with multiple variables in it, like:
a=blah blah
b=more blah
c=even more
d=etc
Right now, I have the file loading & created the dynamic text boxes, but it only seems to recognize the first variable. For example, initially, I only saw variable a, then I switched a & b in the file, then I only saw b.
Can this be done? I'd rather not have to have separate files if possible.
Thanks in advance!
Jessica
Loading Multiple Variables From A Txt File...
...is that possible without using any back-end scripts?
But let me explain better...
I'm making a demo site in wich I have to load some informations regarding commercial activities or public services by a button click. 'cause I'll need to show up data like 'title', 'address', etc. for each activity, how can I do that?
My idea was to create a movie clip with as many textfield as the number of the informations I need to show, and assign a different variable to each of them... is that a correct way? Is it possible to use one single txt file for all the activities I'll need to cover?
I don't know, probably I'm totally lost ... so any help would be much appreciated!
Are Multiple Variables Allowed In A Text File?
I'm dynamically loading text from a seperate .txt file. What I'd like to do is have multiple variables within that file.
The reason I ask is I'm trying to have text formatted depending upon which variable is used.
Is this possible? If so how do I close off each variable so flash knows that the next line is the new variable?
Thanks in advance.
Writing Multiple Variables To A Text File
Hi
I have a number of symbols(many)and hotspots (many) in a movie. When each symbol moves over a hotspot the movie must open a text file and write the details to it. i.e.
Symbol 1
Symbol 2
Hotspot 1
Hotspot 2
When Symbol 1 is passed over Hotspot 1. it writes to a text file.
"Symbol 1, Hotspot 1".
Similarly if Symbol 1 is passed over Hotspot 2. it writes to a text file.
"Symbol 1, Hotspot 2".
Writing to the file is straight forward enough but how can I get it to write which symbol did the rolling over?
thanks in advance
The end application will be a circuit board where users can effectively wire up circuits and test points on the circuit. The symbol will be the connector on a piece of test equipment and the hotspot a test point.
HEELP Reading Multiple Variables From A File
Hi, thanks for taking the time.
I'm loading a text file called "links.txt" like this:
loadVariables("links.txt","");
(I really don't understand using the 0 as the second parameter,
for the level purpose. And I can't make it work for me either)but,
that's my question.)
That file can contain for example: the following:
&url01=www.flashkit.com
&urlname01=Flash Kit
&url02=www.google.com
&urlname02=Google
&url03=www.yahoo.com
&urlname03=Yahoo
&total_links=3
&file=ok
And I can read the variables fine, for string purposes only,
but if I wan't to calculate something with the variable "total_links"
it says NaN (Not a number). So I tried these 3 functions on diferent
examples and I still can't make it a number:
eval(total_links);
parseInt(total_links);
number=Number(total_links);
-I even tried reading the variable like this: number=/:total_links;
and nothing.
-I used loadVariablesNum() to load the file, and it's the same.
-The only way I could use the "total_links" variable as a number, is
loading a separate file called "links_number.txt", and then using the Number() function. But my project team mates say that's no good.
So what can I do ??? How can I use the "total_links" variable as a number ??
Thanks,
Waltman.
Loadinf Multiple Variables From Text File..
Hi:
I am externally loading the text in frame 1 from a text file..
stop();
myText= MyVars.Tx1;
mySlide= MyVars.Lx1;
LessonNameTx=MyVars.Mx3;
Now in frame 2 I do the same from the same text file
stop();
myText= MyVars.Tx2;
mySlide= MyVars.Lx2;
LessonNameTx=MyVars.Mx3;
and in frame 3 the same...can someone please help me here automate this code.. using a variable
Where I can get 1,2 and 3 etc all the way till 45,, get read from a variable.. such that I dont have to go in and enter 1 through 45 all the time..
My text file has &Tx1=something
&Lx1=something
etcetc...
Thanks
[F8] Loading Multiple Variables From Text File
I want the values of the variables in my text file on click of a button in my dynamic text field.My text file is
counter=3
msg1=text1
&msg2=text2
&msg3=text3
..and so on
I just want text1,text2,text3,..and so on to come on click of a button not the value of the counter.Plzz help.Thnx a tonne in advance
Multiple Text Variables In Stored In HTML File?
Hello,
I'd like to be able to call two text variables found in my html if possible. I know how to call one by using the following:
<PARAM NAME=movie VALUE="texttest1.swf?variabletext1=Whatever I want to go here">
I've tried but I can't figure out how to include another variable to store another piece of text in. Any help would be much appreciated.
[Edited by Pampasano on 01-01-2002 at 04:03 PM]
Multiple Dynamic Text Variables In A Single .txt File?
Hello... I was wondering if it was possible to store multiple variables in a single .txt file?...
e.g. lets say i have a dynamic text field (main_txt) and I want the text to change with the press of either button (A_btn) or (B_btn)... my code on buttons is:
for a:
on(release){
main_txt.variable = "somevariableA"
}
for b:
same with change being "somevariableB"
ok...so on my main frame I want to have just a
loadVariablesNum("somefile.txt", 0);
where somefile.txt looks something like this:
somevariableA=blah blah blah
somevariableB=halb hlab halb
... when I try to do it like this, the whole of somefile.txt loads in my field when I click on A_btn and nothing happens when I click on B_btn... to solve the problem I have been loading two seperate .txt files, each containing a single variable... I can do what I want to do, I just want to know if you can store multiple variables in one .txt file?...thanks.
FLMX04: Shortcut For Selecting Objects On Stage (with Selected Key)?
Hello all,
with a key selected in the timeline in the property inspector there are shown the properties of the key (naturally!)
If i want to change i.e. the Alpha of the related Objekt i have to click on this Objekt on the stage first in order to show the properties of the objekt (and not the key) in the prop-inspector.
That sucks, especialy if the objekt is behind another (i.e. text behind a picture). In this case, i have to lock the layer above first. And searching the objekt everytime in the film explorer ist sucking too.
In Flash MX there was a simple trick: selecting the key and klick on a tool in the tool-inspector. But this workaround doesn´t work in MX04.
here is my question:
Does anybody know a command, shortcut or so to select on objekt on stage with an related objekt-key selected?
Thanks for any reply
-kai
[CS3] Issues Creating Multiple MC From Multiple Variable Data Arrays.
I have had some great help with this from some very kind FlashKit members. However I have played with the code extensively and am having an issue getting multiple MC's from the global variable arrays "V_1", "V_2" and "V_3".
Right now I have the code set to build up a scalable graph for array V_1. I have not had it working "properly" to show the other values in graphs side by side for V_2 and V_3. I have had some weird Frankenstein looking results that led me to believe I was on the right track, but only to find that I could not figure it out. I have a g_seperator variable that I was hoping to use to determine the space between each column of data.
Can anyone out there help me please?
Thank you.
here is my code reprinted here, since my flavor of Flash may not export to a version compatible with some of your working versions.
Code:
stop();
//BAR ATTRIBUTES
_global.g_x = 240;// chart starting x position
_global.g_seperator = 130;// distance between bars
_global.g_width = 50;// graph segments width
_global.g_base = 450;// graph starting Y position
_global.g_alpha = 40;
//BOX VALUES
_global.v_1 = new Array(20, 40, 1, 10, 12, 10, 20, 15, 5, 21, 31, 50, 20, 10, 20);
_global.v_2 = new Array(60, 70, 1, 10, 42, 10, 50, 15, 30, 21, 31, 10, 20, 10, 20);
_global.v_3 = new Array(20, 70, 1, 10, 12, 10, 20, 25, 10, 31, 31, 10, 20, 10, 20);
_global.color_set = new Array(0x000099, 0x00FF00, 0xddddd, 0xcccccc, 0x990000d, 0xff9900, 0x99eeee, 0x99cccc, 0xf21000, 0xffdddddd, 0x005900, 0xff00ff, 0x0ff000, 0xff9999, 0xf2f321);
_global.pos_name = new Array("Site3", "Site5", "Site7");
var home = this;
draw1NPositions("mc_pos"+[p],pos_name[p],g_seperator);
function draw1NPositions(mc_pos, positionName, gap) {
this.createEmptyMovieClip(mc_pos,1000);
for (i=0; i<v_1.length; ++i) {
makeBox(i,g_x,g_base,g_width,v_1[i],color_set[i]);
}
}
function drawBox(mc, w, h, color) {
mc.beginFill(color);
mc.lineStyle(0,color,100);
mc.moveTo(0,0);
mc.lineTo(0,-h);
mc.lineTo(w,-h);
mc.lineTo(w,0);
mc.lineTo(0,0);
mc.endFill();
}
function makeBox(num, posX, posY, wide, tall, color) {
var myBox = home.createEmptyMovieClip("box_mc"+num, num);
myBox._x = posX;
myBox._y = posY;
myBox.num = num;
myBox.dragging = false;
drawBox(myBox,wide,tall,color);
myBox.onMouseUp = function() {
this.dragging = false;
};
myBox.onMouseDown = function() {
if (this.hitTest(_xmouse, _ymouse) && !this.dragging) {
this.startY = _ymouse;
this.startX = _xmouse;
this.startH = this._height;
this.dragging = true;
}
};
myBox.onEnterFrame = function() {
for (var i = 1; i<v_1.length; i++) {
boxes[i-1].y = home["box_mc"+(i-1)]._y=home["box_mc"+i]._y-home["box_mc"+i]._height;
}
};
myBox.onMouseMove = function() {
if (this.dragging) {
dist = this.startH-(_ymouse-this.startY);
boxes[this.num].h = this._height=(dist>1) ? dist : 1;
_root.boxValue.text = this._height;
}
};
Mouse.addListener(myBox);
}
EXTREMELY URGENT - Creating Global Variables Using Names Of Other Variables...
I have variables xtile and y tile within a movie, and I need to create a global variable that will tell all other movies that this particular movie is situated on tile [xtile][ytile], so I need to know how to create the global variable: _root.objectmovie_xpos_xtile_ypos_ytile = true;
I know how to create global variables, and how to have other movies read them, but how do I actually create a VARIABLE with this name? I tried set ("_root.objectmovie_xpos_" + xtile + "_ypos_" + ytile") = true, but that doesn't work (which I kinda knew already but thought I would give it a shot)
any ideas peeps?
please help, its vital to a project I am doing
cheers all
AS3: Load Multiple Variables Into Multiple Dynamic Text Fields
I have a php file that makes this list
Code:
Cid1=3
&Lid1=22
&Title1=amazing
&Date1=1212128413
&Ext1=jpg
&Hits1=129
&Rate1=9.5000
&Cid2=1
&Lid2=22
&Title2=cool
&Date2=1212128413
&Ext2=jpg
&Hits2=129
&Rate2=8.5000
Now, I want to load the 7 bits of data into 7 dynamic text boxes.
I have to code to load a movieclip as a button onto the stage.
When I click that button I want the data to load.
I can kind of load all the data as a string into one dynamic field but don't know how to get each variable into a different text box. Any help would be great.
Regards,
Glen Charles Rowell
This is some working code for loading one variable but I need help with the rest please.
Code:
var url:String = "http://www.secretcanttellsorry.php?cid=3&orderby=ratingD&guid=on";
var Cid1:URLLoader = new URLLoader();
Cid1.addEventListener(Event.COMPLETE, completeHandler);
Cid1.load(new URLRequest(url));
function completeHandler(event:Event):void {
poptext.text = event.target.data as String;
}
Loading Multiple Txt Variables Into Multiple Txt Fields From One Txt Doc - POSSIBLE?
I'm wondering, for efficiency sake, if it's possible to load into my main timeline multiple text variables from ONE external .txt document then have that information populate multiple dynamic text fields located in an MC within an externally loaded .swf. held in a containerMC on _level0?-eg path. _level0.containerMC.MCInstanceWithinLoadedSwf.???
If this is possible, how would it be done?Would I simply just use one loadvariableNum action for all?How would the text within the .txt doc be formatted?
- would I simply just list what each textfield variable is = to?
[MX] Multiple Variables Moving Multiple Clips
G'day
I'm pretty new to ActionScript and I'm looking for a fix with a variable.
I have 5 movie clips which I am trying to activate at different times as I move my mouse around the stage.
I'm using this code . . .
var outside = true;
this.onEnterFrame = function()
{if (this._xmouse>66 && this._xmouse<177 && this._ymouse>0 && this._ymouse<650)
{if (outside)
{profile.gotoAndPlay("over");
trace("inside");
outside = false;}}
else {if (!outside)
{profile.gotoAndPlay("out");
trace("outside");
outside = true;}}}
which will play any one of the clips (in this case one called profile) fine but if I duplicate the code it wont work for more than one clip. I'm sure that I'm missing a basic concept here.
Can anybody offer me a fix for this and explain where I'm going wrong?
Thanks
Rickibird
Split Variables Multiple Times Into Different Variables
say you have the string: "tilisamazing" - how would you split that into
var 1 = til;
var 2 = is;
var 3 = amazing;
i know you can do this with substr, but what if you dont know the starting and finishing points???
i have seen people split a variable with a comma... how would u do that for this?
Multiple Users = Multiple File Checks (Log In Stuff)
Code:
on (release) {
//success is true if the file exists
fileExists=new LoadVars();
fileExists.onLoad=function(success) {
if (success && user eq "USER1" && password eq "USER1_PASSWORD_HERE"){
gotoAndPlay ("logging_in");
}
else {
gotoAndStop ("error");
}
}
//initiate the test
fileExists.load("http://www.somewhere.com/Users/USER1FOLDER/FILE_TO_CHECK_FOR.txt");
}
That's the script i've come up with for "USER 1".
See at the bottom is checks for a file so "user 1" can gain access. I'd like to put multiple users in there, and have the code check the specified users "check file", and not the other users files.
User 1 script checks for User 1 File
User 2 script checks for User 2 File
User 3 script checks for User 3 File
...and so forth.
Aside from that, i would like to know if i can have a script that constantly reloads an external .swf file in level 1.
Creating Multiple Objects
In my movie i have 3 movieClips called _parent.allelements.level_1, _parent.allelements.level_2
_parent.allelements.level_3
within each of these their is a set of 3 more movieClips named _parent.allelements.level_1.select1, _parent.allelements.level_1.select2, etc
i used the following code to create a color object for each of the second level movieClips
for (m=0; m<3; m++) {
for (n=0; n<3; n++) {
_parent['colour'+m+"_"+n] = new Color(_parent.allelements['level_'+m]['select'+n]);
}
}
Then later on i used the following code to select only a certain number of the second level movieClips and alter their color using set transform.
for (m=0; m<3; m++) {
for (w=0; w<3; w++) {
if (_parent.allelements['level_'+m]['select'+w].isnotselected == 2) {
_parent['colour'+m+"_"+w].setTransform({ra:100, ga:100, ba:100, rb:_parent.allelements['level_'+m].zpos*multipl, gb:_parent.allelements['level_'+m].zpos*multipl, bb:_parent.allelements['level_'+m].zpos*multipl, aa:100, ab:100});
}
}
}
For some reason this code only works on Clips
_parent.allelements.level_1.select1, _parent.allelements.level_1.select2
_parent.allelements.level_1.select3
in other words only the clips inside the first movieClip _parent.allelements.level_1. I'm sure the if statement is working correctly. Idouble checked that. But i can't see what else i am doing wrong any input would be very mch appreciated
Creating Multiple Sprites In AS3
Hello,
I am having trouble getting some of my old AS2 methods working in AS3.
here is an example of how I used to create multiple movie clips with AS2 and draw in them and position them.
Code:
var colourList:Array = [0x0000FF, 0x00FF66, 0x33FFFF, 0x663300, 0x669933,
0x0000FF, 0x00FF66, 0x33FFFF, 0x663300, 0x669933,
0x0000FF, 0x00FF66, 0x33FFFF, 0x663300, 0x669933];
var blockWidth:Number = 25;
for(i=0; i<=colourList.length; i++){
_level0.createEmptyMovieClip("block"+i, this.getNextHighestDepth());
_level0["block"+i].createEmptyMovieClip("blockHold"+i, 0);
with(_level0["block"+i]["blockHold"+i]){
lineStyle(2,0x333333,blockWidth);
beginFill(colourList[i], 60);
lineTo(blockWidth,0);
lineTo(blockWidth, blockWidth);
lineTo(0,blockWidth);
lineTo(0,0);
endFill();
}
_level0["block"+i]._x = blockWidth*i;
_level0["block"+i]._y = blockWidth*i;
}
How might i in particular achieve these two things with AS3:
A) creating multiple instances of screen objects
and
B) doing things to them in relation to array properties?
thanks
Rob
Should I Still Be Creating Multiple Swfs?
Hi everyone,
I'm a seasoned(ish) flash user since flash4, with a design background I usually managed to get things to work the way I wanted.
I'm pretty new to AS3 so I've brought and read the following:-
Essential Actionscript 3.0 (O'Reiley)
Object-Oriented Actionscript 3.0 (Friends of ed)
Actionscript 3.0 Design Patterns (O'Reiley)
I get the Classes stuff, I get the inheritance, polymorphism, (certain) Patterns, why we use them and kind-a when to use them.
What I'm still struggling with is .....
Should I still be creating multiple swfs?
In the old days, I'd have created a base.swf movie to store all my globally accessible vaiarables. If I wanted to check a languageID i'd call _level0.LanguageID from any other level movie.. easy.
I'd planned for the levels I'd use e.g. Menu.swf on level 3, Content.swf on level 2, Alerts.swf on level 5 etc. Everything worked just fine.
In all of the books that I've read (skim-read some parts), and various online tutorials, it seems that a real life project i.e. anything that is more than a simple demonstration of one class or concept is never discussed. Even the complex examples never touch on multiple swfs in a project.
So, the KILLER question is....
Should I be trying to build everything into a single (possibly large) base movie?
OR
Should I be loading menu.swf etc. into the displayList?
My current considered approach is...
If the second answer is the correct way then,
would a singleton in the main.swf and a whole bunch of custom event handlers be the correct approach?
Any help, pointers, inspiration would be greatly appreciated
Thanks for your time (sorry it turned into a bit of an essay!)
MrFish
Creating Multiple Textfields
If I want to create textfields like this where represents the number of textfields to be created.
_level0.paneContent.createTextField("mytext"+i, 1, 100, 100, 300, 100);
How can I get the properties of each textfields?
_level0.paneContent.mytext +i.text = something;
Creating Multiple Objects: Can Ya?
There are 10 sets of data with four variables each. I want to loop through the data and create 10 objects and add the four pieces of data.
This is what I was trying in a for loop:
module[i] = new Object();
module[i].ppt = ecPath+"_"+num+".jpg";
module[i].toc = toc;
module[i].txt = txt;
module[i].voc = ecPath+"_"+num+".voc";
Then trace, but I get undefined.
trace(module[i].ppt);
trace(module[i].voc);
trace(module[i].toc);
trace(module[i].txt);
I know I'm doing this wrong. Please offer any guidance or better way of methodology. Appreciate the expertise in this community...
Creating Multiple TextFields
I thought I knew what I was doing.
I'm creating a logbook form that has about 500 different input textFields. Using a simple for loop, I trying to create a portion of the textFields then change their properties to an Input textFeild that is prepopulated with data.
Here's the code:
var maxColumns:Number = 10;
var maxRows:Number = 8;
var tc_TabOrderStart = 13;
var xStart:Number = 256;
var yStart:Number = 123;
var xOffset:Number = 46.3;
var yOffset:Number = 21.8;
var txtFieldWidth:Number = 41;
var txtFieldHeight:Number = 81;
for (var j:Number = 0; j<maxRows; j++)
{
for (var i:Number = 0; i<maxColumns; i++)
{
var tc_tfld:String = "tc"+j+"_"+i;
trace("tc_tfld = "+tc_tfld);
this.createTextField(tc_tfld, this.getNextHighestDepth(), xStart+(xOffset*i), yStart+(yOffset*j), txtFieldWidth, txtFieldHeight);
with (this.tc_tfld)
{
type="input";
text = "DUMB";
}
}
}
Thanks for any help. I've been stuck for three days.
Creating Multiple Movieclip
Hello to all!!!
It is posible to create multiple movieclip in stage by clicking one button with different instance name.
Creating Multiple Movie Clips
Hi there - here is what I'm trying to achieve:
I have a m/c of a small square rotating from edge on to face on via it's Y axis. I want to now, using duplicateMovieClip, create 25 of these, in a grid 5 x 5, one after the other, playing as they are created.
I know how to create the 25 duplicates, using Linkage in the library and something like this:
Code:
for (i=1; 1<=25; i++) {
square_mc.duplicateMovieClip("square" + i + "_mc", i)
}
But once they are created, how do I reposition them? Also I will need to be able to determine once 5 are created so that a new line is started.
Would it be something like this: Set a first X and Y position before the loop and after each pass, use -
Code:
this._x = n + somenumberofpixels
this._y = g + somenumberofpixels
where n is the preset _x before the loop and g is the preset _y before the loop and somenumberofpixels is the size of the square after full rotation plus a little gap inbetween?
Sorry my text sounds/reads a bit messy; I can see the solution, but I just don't know how to reach it.
cheers
frank
Creating Single Mc From Multiple Mcs On Different Layers
Could someone tell me how to take multiple layers of already created movie clips and combine them into one movie clip? It's easy to create a movie clip of a movie clip, but I'm not sure how to do so in this case.
Also, is it possible to do the same thing for a layer of shape tweens?
TIA,
aaroneousmonk
Creating Multiple Mask Layers
How can you link more than one mask to a layer.......need to know since motion tween only supports one symbol per layer
Creating A Search For Multiple Fields
Hi there
I am needing to create a search box that will search on multiple fields from a SQL database. This is for a local intranet and I have no idea where to start. I am just a beginner at this and have very basic coding skills. any help would be greatly appreciated.
Help With Creating Multiple MC,(source Included)
okay here is what I have on the stage in layer called enemy :
Code:
//basic def
this.depth2 = 1;
//i = random(6)+1;
for(a=0;a<6;a++) {
enemyName="oneEnemy"+String(this.depth2++);
this.attachMovie("applets", enemyName, this.depth2);
}
and here is the code for the mc "applets"
Code:
//basic definitions
enemyx = random(400)+50;//_root['oneCloud'+_root.i]._x;
enemyy = -10;//(_root['oneCloud'+_root.i]._y)+5;
this.state = 0; //frame number
this.chooser = random(2)+1; //chooses left or right
//spc = 0;
if(this.chooser == 1) {
this.state = 1;
}
else if(this.chooser == 2) {
this.state = 3;
}
gotoAndStop(1);
enemyvx = -2;//(_root['oneCloud'+_root.i].cloudv); //velocity along x
enemyvy = 0; //velocity along y
yFriction = 1.6; //acceptable values: 2.2 --> 1.6
xFriction = 1.05;
acceleration = 9.8; //gravity
time = Math.floor(getTimer()/1000); //time in whole seconds
this.onEnterFrame = function() {
enemyx += enemyvx; //add velocity to x
enemyy += enemyvy; //add velocity to y
this._x = enemyx; //set x coordinate
this._y = enemyy; //set y coordinate
enemyvx = (enemyvx/xFriction); //lower xvel with horizontal friction
enemyvy = (enemyvy + acceleration + time)/(yFriction); //calculate new velocity
time = Math.floor(getTimer()/1000); //update Time
/*if(spc == 1 || spc == 2 || spc == 3) {
this.state += 1;
gotoAndStop(this.state);
}
else if(spc == 4 || spc == 5 || spc ==6) {
this.state -= 1;
gotoAndStop(this.state);
spc=1;
}
spc++;*/
}
when i test movie nothing shows up, why is this?
Creating Multiple Movieclips And Controlling Them
Okay so i have actionscript that creates a ball and places it outside of the stage and moves it across the stage for a game im trying to make and i have it working for 1 ball but i want to be able to create another ball that moves at the same time as the first... please respond if you don't understand. I'll show you waht i have for it working for one ball and what i have for what i tried to do which resulted in it not moving the balls at all.
var i = 0;
var speed = 30;
var x1 = Math.floor(Math.random() * 550);
var x2 = Math.floor(Math.random() * 550);
var y1 = -50;
var y2 = 450;
var xdistance = x2 - x1;
var ydistance = y2 - y1;
var xmove;
var ymove;
setInterval(drawBall, 10000);
function drawBall()
{
i++;
_root.attachMovie("ball", "ball" + i, getNextHighestDepth());
createball("ball"+i);
}
function createball(ball)
{
trace(ball);
var rand = Math.floor(Math.random() * 4);
if (rand == 1)
{
//from top
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y1;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
else if (rand == 2)
{
//from bottom
ydistance = y1 - y2;
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y2;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
else if (rand == 3)
{
//from left
x1 = -50;
x2 = 600;
y1 = Math.floor(Math.random() * 400);
y2 = Math.floor(Math.random() * 400);
xdistance = x2 - x1;
ydistance = y1 - y2;
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y2;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
else
{
//from right
x1 = 600;
x2 = -50;
y1 = Math.floor(Math.random() * 400);
y2 = Math.floor(Math.random() * 400);
xdistance = x2 - x1;
ydistance = y1 - y2;
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y2;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
}
and for the working for one ball i have...
var i = 0;
var speed = 30;
var x1 = Math.floor(Math.random() * 550);
var x2 = Math.floor(Math.random() * 550);
var y1 = -50;
var y2 = 450;
var xdistance = x2 - x1;
var ydistance = y2 - y1;
var xmove;
var ymove;
_root.attachMovie("ball", "ball", getNextHighestDepth());
createball();
function createball()
{
var rand = Math.floor(Math.random() * 4);
if (rand == 1)
{
//from top
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y1;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
else if (rand == 2)
{
//from bottom
ydistance = y1 - y2;
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y2;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
else if (rand == 3)
{
//from left
x1 = -50;
x2 = 600;
y1 = Math.floor(Math.random() * 400);
y2 = Math.floor(Math.random() * 400);
xdistance = x2 - x1;
ydistance = y1 - y2;
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y2;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
else
{
//from right
x1 = 600;
x2 = -50;
y1 = Math.floor(Math.random() * 400);
y2 = Math.floor(Math.random() * 400);
xdistance = x2 - x1;
ydistance = y1 - y2;
xmove = xdistance / speed;
ymove = ydistance / speed;
ball._x = x1;
ball._y = y2;
_root.onEnterFrame = function()
{
ball._x += xmove;
ball._y += ymove;
};
}
}
the fla can be found at http://giraph.ath.cx/testangles/ballmovetest004.fla
and the swf at
http://giraph.ath.cx/testangles/ballmovetest004.swf
please respond if you need any clarifaction
Creating Multiple Text Fields
I try to create with loop more text fields but i my code no works ;(
Code:
for (i = 0; i < total; i++)
{
var_descr_gall = "descr_gall_" + i;
_root.createTextField (var_descr_gall, i, 0, 0 * i, 200, 20);
var_descr_gall.border = true;
var_descr_gall.text = "aaa";
trace ("var_descr_gall = " +var_descr_gall.text );
}
}
The var_descr_gall.text is undefinied.
Later i need load in this text fields content of XML. Something like that:
Code:
var_descr_gall.text =xmlNode_gal.childNodes[i].childNodes[0].firstChild.nodeValue;
Thanks
Creating Multiple Textfields Programatically
hi I am doing some work with creating textfield programatically.
USING mx2004
The code is written to create 2 text fields with properties based on the value of tmp[i].
I am having trouble applying text formatting after I have created each of the texfields.
ANy Ideas? I have tried using eval("myTextFormat" + i) instead of just myFormat, it causes a syntax error. How can i get the formatting to apply for each textfield?
Thanks
______________________________________
CODE FOLLOWS
______________________________________
var jsVar1 = "100,50,ff,0xff0000,24,Verdana,false,false|100,100 ,gg,0xff9900,24,arial,false,false";
var elements = jsVar1.split("|");
trace(elements.length);
for(i = 0; i <= elements.length-1; i++)
{
tmp = elements[i].split(",");
for( k = 0; k <= elements.length-1; k++)
{
_root.createTextField("myPoint" + i , 100 + i ,100,100,85,85);
eval("myPoint" + i)._x = tmp[0];
eval("myPoint" + i)._y = tmp[1];
eval("myPoint" + i).text = tmp[2];
myFormat = new TextFormat();
myFormat.color = tmp[4];
myFormat.size = tmp[5];
myFormat.font = tmp[6];
eval("myPoint" + i).setTextFormat(myFormat);
}
}
Creating Multiple Size Formats
I need to create a Flash movie that needs to fit into several different size banners. I am trying to figure out the best approach- does anyone have any experience doing this, and if so, how did you go about it?
Creating Multiple NetStreams Dynamically?
hi guys..i am trying to get multiple videos to dynamically load and play on the stage. I think i am getting close, but i am hung up on how to duplicate the netStream class in the funciton. I know that the videos will not work using only one netStream. Any ideas on how to create multiple streams?
Code:
var ncConnect:NetConnection= new NetConnection();
ncConnect.connect(null);
var mcHolder:MovieClip=this.createEmptyMovieClip("mcHolder",2005);
var vidXML:XML= new XML();
vidXML.ignoreWhite=true;
vidXML.onLoad=function(){
var root=vidXML.firstChild.childNodes;
for(i=0;i<root.length;i++){
var vidThumbs=mcHolder.attachMovie("mcVideo","mcVideo"+i,i);
var videos:Video=vidThumbs.theVideo;
videos.attachVideo(streams);
var streams:NetStream= new NetStream(ncConnect);//here is where i am stuck!
streams.play("images/"+root[i].attributes.videoSource);
}
}
vidXML.load("images/Videos.xml");
Creating Multiple Similar Movieclips?
I want to create multiple movieclips (with the same behaviour and looks) by pressing enter. Or any other action, but for now I put it under an enter for testing.
The code below makes a new clip the first time enter is pressed, but instead of creating a new movieclip after that, it just seems to reset the previous movieclip.
Code:
if (Key.isDown(Key.ENTER)) {
if ( nrOfBalls < 5 )
{
this.attachMovie( "PingPong", "PingPong"+nrOfBalls, 0 );
nrOfBalls += 1;
}
}
What am I doing wrong?
Creating Multiple MovieClips With ActionScript
For some reason both movieClips are instantiated but gets loaded but my second movieClip will not load the png image. What am i doing wrong
Thanx Marijntje
Code:
this.createEmptyMovieClip("navigation_mc", this.getNextHighestDepth());
var navigationListener:Object = new Object();
navigationListener.onLoadInit = function(){
navigation_mc._width = 800;
}
var navigationBackgroundLoader:MovieClipLoader = new MovieClipLoader();
navigationBackgroundLoader.addListener(navigationListener);
navigationBackgroundLoader.loadClip("http://www.h-g.dev/core/img/nav_bg.png", navigation_mc);
this.navigation_mc.createEmptyMovieClip("home_mc", this.navigation_mc.getNextHighestDepth());
var homeButtonListener:Object = new Object();
homeButtonListener.onLoadInit = function(){
//home_mc._width = 800;
}
var homeButtonLoader:MovieClipLoader = new MovieClipLoader();
homeButtonLoader.addListener(homeButtonListener);
homeButtonLoader.loadClip("http://www.h-g.dev/core/img/nav_home_nl_nl.png", home_mc);
Creating Multiple Movieclips With For Loop Help
How can I dynamically create multiple MovieClips and attach to the stage using a for loop?
for (var j:Number = 0; j<total; j++) {
var my_mc1:MovieClip = trackHolder.attachMovie("DefaultBtn", myHolder.getNextHighestDepth())
};
I need to change the name of my_mc1 to my_mc + j.
How can I do this.
Help appreciated
paulie
|