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




Which Variable Is Biggest Determination?



The problem is that win2 and tab will always be "de radikale" for some reason.(I know that is because of that none of the others are true, but why are they not, some of them has to be) Why????
The variables are just numbers
Everything not translated to danish is unimportant.
The only thing the code does is determing which of the variables there are highest, next-highest and lowest.

// Hvilket parti har flest point og
// vil udfylde "win" variablen
if (K>=V && K>=A && K>=Ø && K>=O && K>=Q && K>=R) {
win = "Konservativt Folkeparti";
} else if (V>=A && V>=Ø && V>=O && V>=Q && V>=R) {
win = "Venstre";
} else if (A>=Ø && A>=O && A>=Q && A>=R) {
win = "Socialdemokratiet";
} else if (Ø>=O && Ø>=Q && Ø>=R) {
win = "Enhedslisten";
} else if (O>=Q && O>=R) {
win = "Dansk Folkeparti";
} else if (Q>=R) {
win = "Kristeligt Folkeparti";
} else {
win = "De Radikale";
}
// Hvilket parti har fået mindst point og
// vil udfylde "tab" variablen
if (K tab = "Konservativt Folkeparti";
}
else if (V tab = "Venstre";
}
else if (A<Ø && A tab = "Socialdemokratiet";
}
else if (Ø tab = "Enhedslisten";
}
else if (O tab = "Dansk Folkeparti";
}
else if (Q tab = "Kristeligt Folkeparti";
} else {
tab = "De Radikale";
}
// Hvilket parti har fået næstflest stemmer
// og vil udfylde win2
if ((KV && K>A && K>Ø && K>O && K>Q && K>R)) {
win2 = "Konservativt Folkeparti";
}
else if ((VA && V>Ø && V>O && V>Q && V>R)) {
win2 = "Venstre";
}
else if ((AØ && A>O && A>Q && A>R)) {
win2 = "Socialdemokratiet";
}
else if ((ØO && Ø>Q && Ø>R)) {
win2 = "Enhedslisten";
}
else if ((OQ && O>R)) {
win2 = "Dansk Folkeparti";
}
else if ((QR)) {
win2 = "Kristeligt Folkeparti";
} else {
win2 = "De Radikale";
}



FlashKit > Flash Help > Flash ActionScript
Posted on: 12-11-2002, 02:11 PM


View Complete Forum Thread with Replies

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

Which Variable Is Biggest Determination
The only thing this code does is to check which of the variables there are biggest, next biggest, and lowest. For some reason will win2 and tab always be "de radikale".

The variables are just numbers. Everything in danish is just some comments.'

// Hvilket parti har flest point og
// vil udfylde "win" variablen
if (K>=V && K>=A && K>=Ø && K>=O && K>=Q && K>=R) {
win = "Konservativt Folkeparti";
} else if (V>=A && V>=Ø && V>=O && V>=Q && V>=R) {
win = "Venstre";
} else if (A>=Ø && A>=O && A>=Q && A>=R) {
win = "Socialdemokratiet";
} else if (Ø>=O && Ø>=Q && Ø>=R) {
win = "Enhedslisten";
} else if (O>=Q && O>=R) {
win = "Dansk Folkeparti";
} else if (Q>=R) {
win = "Kristeligt Folkeparti";
} else {
win = "De Radikale";
}
// Hvilket parti har fået mindst point og
// vil udfylde "tab" variablen
if (K<V && K<A && K<Ø && K<O & K<Q & K<R) {
tab = "Konservativt Folkeparti";
}
else if (V<A && V<Ø && V<O && V<Q && V<R) {
tab = "Venstre";
}
else if (A<Ø && A<O && A<Q && A<R) {
tab = "Socialdemokratiet";
}
else if (Ø<O && Ø<Q && Ø<R) {
tab = "Enhedslisten";
}
else if (O<Q && O<R) {
tab = "Dansk Folkeparti";
}
else if (Q<R) {
tab = "Kristeligt Folkeparti";
} else {
tab = "De Radikale";
}
// Hvilket parti har fået næstflest stemmer
// og vil udfylde win2
if ((K<win) && (K>V && K>A && K>Ø && K>O && K>Q && K>R)) {
win2 = "Konservativt Folkeparti";
}
else if ((V<win) && (V>A && V>Ø && V>O && V>Q && V>R)) {
win2 = "Venstre";
}
else if ((A<win) && (A>Ø && A>O && A>Q && A>R)) {
win2 = "Socialdemokratiet";
}
else if ((Ø<win) && (Ø>O && Ø>Q && Ø>R)) {
win2 = "Enhedslisten";
}
else if ((O<win) && (O>Q && O>R)) {
win2 = "Dansk Folkeparti";
}
else if ((Q<win) && (Q>R)) {
win2 = "Kristeligt Folkeparti";
} else {
win2 = "De Radikale";
}


Thanks in advance.

Jump Year Determination
Trying to determine if it's a jump year or not...

I thought of checking divisibility by 4...but there's no mod (or similar that I can find) function in Flash. Anyway to see if the division has remainders or not?

Any other ideas of how to attack it? Thought of using string.split()...could work but all the object handling gets to be a pain.

Am working in Flash 5 now...plan to be in MX before too long.

Cheers,

Galego

Character Scale Determination
I was hoping someone could help me with a script to make the character in my game shrink or grow by a certain amount for each Y that is added to or subtracted from its position. That is the size of the character will be determined by its Y coordinate at that moment. I need this to make the perspective in my game more realistic. The levels have perspective but the character stays the same size all the time, giving the impression that it's growing since the room is smaller toward the back.

I tried having the scale grow when the down key is pressed and shrink for the up key, but that's really not a good way to go about it. Too many weird glitches.

I would like to tell the game to make the character a certain size at the very top Y coordinate, and a certain size at the very bottom, and then have it calculate how big the character should be according to where it is between those points.

Can anyone help? I really need to straighten this out before I can continue to work.

The Biggest Problem...
..for me now, after all the work on my design, is the publishing??? it cant be so hard!! i looks fine on my computer (1024x768) , but as soon as i have a lower res it looks way too small (the movie itself is 800x600). i used the % publishing settings so its always fully in the browser. what can i do? i dont want to design it for 2 resolutions..

Biggest Number $$$
I neede this doing very quickly so I will pay to have it done.

I have 10 Variables:

_root.Q1 = "1";
_root.Q2 = "2";
_root.Q3 = "3";
_root.Q4 = "4";
_root.Q5 = "5";
_root.Q6 = "6";
_root.Q7 = "7";
_root.Q8 = "8";
_root.Q9 = "9";
_root.Q10 = "10";
_root.ans = "4.5";

These will eventually become random, but I need to have this sorted out first.

well....erm this is gonna take some explaining. This is a school project so I cannot do this any other way. I need to be able to do all this without arrays.

I am making a game.

I need to be able to find out the numbers that are progressivly bigger than _root.ans . and I need to assign these numbers in order to the following names


_root.Q1A = "";
_root.Q2A = "";
_root.Q3A = "";
_root.Q4A = "";
_root.Q5A = "";
_root.Q6A = "";
_root.Q7A = "";
_root.Q8A = "";
_root.Q9A = "";
_root.Q10A = "";

_root.Q1A being the smallest number that is bigger that _root.ans .
Then _root.Q2A would be the next biggest.

If anyone could help please reply with your palpay email address at the bottom of the post. I will pay your ciountry's equivelent of £30.

I'm Probably Going To Look Like The Biggest Newb Here...
But how do I change the background color of a scene without changing the entire movie's background color?

I'm a newb. Seriously, please forgive me. Note, I only own Flash 5..

Biggest Array?
Hi,

quick question, whats the biggest array size Flash can handle? and when I say handle I mean be able to look through quickly.

thanks for any help.

regards
boombanguk

Biggest Web Community
I am currently trying to build the biggest iso community on the net......we have the programmers, we have the concept artists we need iso and pixel artists

our team currently consists of:

2 professional back-end programmers

2 professional graphic designers

numerous art students

1 professional web designer

we are working to create a massive online community based in mediaevil times, so lots of castles dragons, kinghts, orcs goblins, trolls....well basically think lord of the rings........in the community people will be able to decided on what creature they would like to start as, and of course they can alter and change the characters head shape, eyes, clothes.....all the usual....as people play in the community they can better their characters skills in magic, fighting, commerce, black magic, battle tactics and many many more ......... their aim.......to be cometo king of the land..............so who ever id the current king watch out cos everyone wants to kill you.................players can do this either becoming the ultimate warrior and recruit other players to join forces to over run the kings castle and ran sack his treasury...................or people can create a huge business empire: owning blacksmiths, bakeries, butchers, farms and numerous others, in an attend to become to richest player, and be able to buy the king out, or simple just hire a huge army to destroy him......................as players get better and better and their money in the game increases they will be able to upgrade their homes and shops and buy bigger and better tools so they can produce more and make more money.

does this sound like something you would be interested in helping with?

if so either drop a post or email me at xtremetom@hotmail.com.

our current business play is to produce a working prototype in about 3-5 months which we can then take to major corporations for possible investment.

cheers tom

Biggest. Error. Ever.
I had been working on a rudimentary platformer game on Flash CS3, until I tried to load a bitmap greater than the maximum size. Even though I've axed that section of the code, restarted the program, and restarted the computer, it acts like I've loaded the too-big-bitmap again.

It gets better. In desperation, I made the block of code that used to start loading the oversize bitmap throw a standard error. I was treated to an error so large that it contains 199 separate errors in this pattern:

Code:
verify com.flashgames.bunnyhopper::LevelManager/setLevel()
stack:
scope: [global Object$ flash.events::EventDispatcher$ flash.display::DisplayObject$ flash.display::InteractiveObject$ flash.display::DisplayObjectContainer$ flash.display::Sprite$ com.flashgames.bunnyhopper::LevelManager$]
locals: com.flashgames.bunnyhopper::LevelManager * * * * * * * *
...followed by this cryptic output:

Code:
VerifyError: Error #1058: Illegal operand type: * must be int.

at com.flashgames.bunnyhopper::LevelManager/setLevel()
at com.flashgames.bunnyhopper::LevelManager/xmlLoadedListener()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.learningactionscript3::LoadText/onComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
Here's the culprit block of code:

ActionScript Code:
private function setLevel():void {    throw new Error('Big Nasty Error!');        fireController = new FireController();        levelSprites = new Sprite();    addChild(levelSprites);        enemies = [];    projectiles = [];    items = [];        var fighterInfo:XML = levelsXML.level.(@num == levelNum).fighter[0];    var FighterType:Class = getDefinitionByName("com.flashgames.bunnyhopper." + fighterInfo.@type) as Class;    fighter = new FighterType(this);    fighter.x = fighterInfo.@x;    fighter.y = fighterInfo.@y;    addFighter(fighter);        for each (var enemyInfo:XML in levelsXML.level.(@num == levelNum).enemy) {        var EnemyType:Class = getDefinitionByName("com.flashgames.bunnyhopper." + enemyInfo.@type) as Class;        var enemy:Enemy = new EnemyType(this);        enemy.x = enemyInfo.@x;        enemy.y = enemyInfo.@y;        addEnemy(enemy);    }    var goal:Goal;    for each (var itemInfo:XML in levelsXML.level.(@num == levelNum).item) {        var ItemType:Class = getDefinitionByName("com.flashgames.bunnyhopper." + itemInfo.@type) as Class;        var item:Item = new ItemType(this);        item.x = itemInfo.@x;        item.y = itemInfo.@y;        addItem(item);    }        var terrainURL = levelsXML.level.(@num == levelNum).@terrain;    var bgURL = levelsXML.level.(@num == levelNum).@background;        bgLoader = new Loader();    bgLoader.load(new URLRequest(bgURL));    bgLoader.contentLoaderInfo.addEventListener(Event.INIT, imageLoadedListener, false, 0, true);        terrainLoader = new Loader();    terrainLoader.load(new URLRequest(terrainURL));    terrainLoader.contentLoaderInfo.addEventListener(Event.INIT, imageLoadedListener, false, 0, true);        numLoading = 1;}

The only thing I can think of to try now is reinstalling CS3, but I want some professional opinions first. Does anybody know what all this means?

I Am Probably Your Biggest Noob
But hey here goes i play a game called counter-strike , i have a clan , and all that . I was wondering if one you experts would make my clan a intro site
heres my site to check it out
URL
ty for your time

Biggest Problem Ever Posted
hi fellows.this is going to be a real test for u flash guru's as i am having real trouble here. i am trying to develope a game in flash for bursting bubbles .. the bubble are going to bounce inside a frame .
wat i want to do is that when some missle or laser should hit the bubble it should duplicate itself and then the duplicated bubble should start bouncing in the opposite direction then the original one but i still can't figure out how to do it . pls help me with this problem . i am really freaked out

Biggest N00b Qusetion Out There....
Ok I used flash back in the day, and I think its cause I'm having a brain fade and right now but I'll ask anyways...

In FLASH MX 2004 (just got it for a gift) w00t

how do i make a button, i read this Tutorial but it says once you make it a button, they it will add 4 other frames Up down over blah
but mine does do that, mabye I'm reading an old Tutorial

lol

I know this is n00b but could someone take the extra second to write to me

thanks

Biggest Newb Question
I just got the macromedia studio mx.
There are so much to learn here.
From what i was told is that I don't really need to learn dreamweaver and that i should go straight to Flash.
Now ....I was also looking at fireworks to help build sites.
So i guess my question is / can i take a shortcut and just learn flash or should i take fireworks as well as other macromedia software.
Thanx for helping

Biggest Noob Question Ever
What is the average size to have a flash movie?... like www.wiretree.com what size is that?...

(one Of) The Biggest Shame Of My Life
I had to present a lecture today, and it was about the connexion betwwen flash, php and mysql. I prepared a lot of files showing how the queries could be made, increasing the level of complexity, form loadVariables to data sharing with amfphp.
Then, I came one hour earlier this mornig, to prepare the files, create the database, install components and etc...
Well, for my surprise, nothing worked. I had to say I was sorry because I was not going to show the results of the queries, and you imagine how mad the audience was....
Now, her's a list of the things I tried to do to fix the problem: remember: I came one hour before the sceduled.
1. Path problem: no, it wasn't...
2. Wrong passwords for the database: no, it wasn't...
Php queries works, it means that it was not a path issue.

3. Version problem: nope. The installation of all that system is just like mine.

So, I accessed my swf files from the browser, and, for my surprise, the swf opend in a new window. I wrotte a html file with one of those file embeded, and the browser didnt read it!
What the heck! I though, is it possible that I do not have flash plugin installed? I installed flash certainly more than 10 times, and I know that the plugin is installed along!

Please, if someone has a hint on what went wrong please tell me!
tnx

Biggest ActionScript N00b Ever
Ok so yea I just fell of the turnip truck...

Anyway I'm making this game where this arrow shoots and hits a target and you get points and stuff... ok so now I want the user to be able to input the speed and angle they shoot the arrow at. I think I have the physics down, I just need to know how I can get a user to be able to input say "52" in a text field, and then that gets defined as a variable or something.

If you have questions just ask... sorry I'm such a n00b.

Biggest ActionScript N00b Ever
Ok so yea I just fell of the turnip truck...

Anyway I'm making this game where this arrow shoots and hits a target and you get points and stuff... ok so now I want the user to be able to input the speed and angle they shoot the arrow at. I think I have the physics down, I just need to know how I can get a user to be able to input say "52" in a text field, and then that gets defined as a variable or something.

If you have questions just ask... sorry I'm such a n00b.

What's The Biggest Thing You Have To Learn Going From Flash 5 To MX ?
Hi - new MX user here.. experienced w/flash 5... what was hardest for you to learn, making the transition to MX?

and any other tips to a newbie MX user would be much appreciated. I don't use actionscript other than button links, so not concerned w/enhancements there..

but, in getting started w/MX, any tips re configuration changes I should make to default settings, and other tips for a new MX user?


mucho appreciado flash dudes...

Whats The Biggest Differences In Pro And Regular Mx?
Im in the process of learning action script using a video tutorial but i have pro and its for regular mx..... i am trying to decide of i want to go back to the regular mx or just stick it out with pro!!!! Whats will i be missing if i go backwards back to regular mx?????

The Biggest And High Quality Library
brought you by : www.imagine-center.com
on top menu click on library !


the biggest free high quality flash library on the net ,
http://www.imagine-studio.net/library/flashdl.html

you guys please check it out and tell me what you think.
for any suggestions for new items works drawings etc to the library tell me.
im creating new things every day!

thanks cya

Biggest Noob Question Of All Time
hey guys.. had a really silly and i'm guessing easy question for ya..

i've got myself a .swf and a .html file of the intro i'd like to add to my site.. site isn't anything amazing.. just a basic site with some links to some random nonsense i've put up to download and such.

trying to figure out where and how to put this silly little flash intro i made.. i know jack about flash.. almost nothing about html.. any help you could give me would be greatly appreciated..

thanks..

m

i think perhaps i put this in the wrong forum.. my apologies.. repost in correct.. mod or mods can feel free to delete.

Biggest Noob Question Of All Time
hey guys.. had a really silly and i'm guessing easy question for ya..

i've got myself a .swf and a .html file of the intro i'd like to add to my site.. site isn't anything amazing.. just a basic site with some links to some random nonsense i've put up to download and such.

trying to figure out where and how to put this silly little flash intro i made.. i know jack about flash.. almost nothing about html.. any help you could give me would be greatly appreciated..

thanks..

m

Continuous Background And Biggest Size?
Look at this site http://www.niciezalavilla.com/ and tell me how to make the background continue like that...also, how does it fit exactly to the screen size?


thanks,
Dean

Continuous Background And Biggest Size?
Look at this site http://www.niciezalavilla.com/ and tell me how to make the background continue like that...also, how does it fit exactly to the screen size?


thanks,
Dean

Whee Who Wants To Help The Biggest N00b In The Known Universe? (that's Meeee)
Hi everyone.. ::waves:: The subject line basically says it all - I'm quite new to Flash and there's just something about it that I can't wrap my mind around. Sooo confusing..Argh. Anyway.

Right now I'm having trouble with movie clip symbols. Specifically, I'm trying to motion tween (and scale) a simple movie clip I made, and it just doesn't want to work. Is what I'm trying to do even POSSIBLE? I don't see any reason why it wouldn't be...but like I said, I'm new and have no idea what I'm doing ^^;

BIGGEST NOOB QUESTION: Google Search
I feel embarraced to ask this since it seems so nooby

but how do i make my flash movie show up in a google search???
I take it you must have to edit the Flash HTML file that gets published
with dreamweaver

but i really dont know dreamweaver at all...

Please Help people find ME!!!!
LOL

Thanks guys

The Biggest Picture Of Abobe + Other Programs Working Together
I couldn't find a good place to post this, but here is as good as any i suppose.

I have a feeling that many people (including me) end up wasting a lot of time because they are not aware that other programs are designed to meet the shortfalls of the ones they know.

I am looking for good sites that you guys have come across that give a clear and CONCISE summary of how all these programs of today work together. Optimally would be a site that describes a problem then talks about or shows a solution using different combonations of programs... I know thats pretty niche of a site, but you never know....

Thanks for any pointers!

What Is The Biggest Pixel Size You Can Have W/o The Browser Scrollbar?
I was wondering how big (in pixels) your background for your website can be before the browser scroll bar starts showing up. Also, what's the width for the background to stretch all the way across the browser so there is no html?

Like these guys, see how it goes all the way across and everywhere you right click it's flash - no html?

see here:
http://blur.com/indexs.html

What Is The Biggest Pixel Size You Can Have W/o The Browser Scrollbar?
I was wondering how big (in pixels) your background for your website can be before the browser scroll bar starts showing up. Also, what's the width for the background to stretch all the way across the browser so there is no html?

Like these guys, see how it goes all the way across and everywhere you right click it's flash - no html?

see here:
http://blur.com/indexs.html

Set One Variable Equal To Another Variable And Using Another Variable To Call It.
set one variable equal to another variable and using another variable to call it.

multiple vars on main stage.
var x in MC with
var y in same MC.

i want to set x = one of the the var on the main stage using var y to define which one.

Thanks
Keith

How Do I Make A Variable Store A Variable? - Dynamic Input Stuff ...
Hey, I got a little problem which I've usually been able to work around but in this particular case there really isn't another way. I want to give in a variable, say "x+x" and then use it as "x+x" and not as their assigned values ...

my result should be that I can alter the course of a loop like this ... for example:

input in text field = x+x

for(x=0,x<=50,x++){
...

y[x]=x+x

...
}

and if I give in 2*x it would make y[x]=2*x

I have no idea if there's a way in flash to accomplish this but if there is I'd sure like to know, thanks for any help I receive, I'll check back here soon.

Dynamic Text Field Is Calling The Variable Name Instead Of Variable Content
I'm having a problem getting something to work. I'm sure it has something to do with string variables and my syntax, but can't figure it out.

I have variables named cust1, cust2, cust3, etc. that are being loaded from a text file (these are customer names that will display in a text ticker).

I want a dynamic text field to display the customer names in incremental order, so I created a variable that consists of the string "cust" + a numeric variable called custNumber. At the end of each pass of the movie, custNumber is increased by 1.

var custNumber = 1;
var custName = "cust"+custNumber;

I want the dynamic text field to call the variable custName, but I can't get it to work. It keeps displaying custName as a string ("cust1", "cust2", etc.).

So I created a new variable called scrollText for the dynamic text to call, and made scrollText = custName;. But it does the same as above.

How do I get my dynamic text to call the variable that I create with another variable?

I want my dynamic text field to display the variable cust1, cust2, cust3, which would be "Jones Plumbing," "Smith Electric" etc., but all I'm getting is "cust1", "cust2", "cust3" etc.

Thanks,

Thom

Problem Assiging Class Variable To The Main Timeline Variable .... PLEASE HELP
Hi Guys

I just can't seem to solve this problem!!!

I have a random class that generates a random image and an id number from an xml file and a main class that reads information from an xml file according to the id number.

I'm having trouble assigning my random id number from my class to the _root.id variable on the main timeline for my other class to read. I keep getting undefined???

Random Class Code:


Code:

import mx.utils.Delegate;
class randomClass {

public var target_mc:MovieClip;
private var _xml:XML;
private var myTotal:Number;
private var random_number:Number;
public var myFid:Number;
private var myPic:String;
private var myTitle:String;

private var myImages:Array = new Array();
private var myTitles:Array = new Array();
private var myFids:Array = new Array();
function randomClass(url:String, target:MovieClip)
{
target_mc = target;
_xml = new XML();
_xml.ignoreWhite = true;
_xml.onLoad = Delegate.create(this, onLoadEvent);
_xml.load(url);
}

function onLoadEvent(success:Boolean):Void
{
if (success)
{
var i:Number;

myTotal=_xml.firstChild.childNodes.length;

for(i=0; i<=myTotal-1; i++)
{
myImages[i]=_xml.firstChild.childNodes[i].firstChild.firstChild;
myTitles[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.firstChild;
myFids[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.firstChild;
}

random_number=random(myTotal);

myPic="<A href="http://www.mydomain/images/"+myImages[random_number">http://www.mydomain/images/"+myImages[random_number];
myTitle=myTitles[random_number];
myFid=myFids[random_number];

target_mc.title.text=myTitle;

var TheMovieLoader = new MovieClipLoader();
TheMovieLoader.loadClip(myPic, target_mc.new_mc);

var pictureLoaderListener = new Object();
pictureLoaderListener = TheMovieLoader.onLoadComplete()
{
target_mc.new_mc._x=-9;
target_mc.new_mc._y=-5;
target_mc.new_mc._xscale=40;
target_mc.new_mc._yscale=40;
}
TheMovieLoader.addListener(pictureLoaderListener);
target_mc.random_id.onPress = Delegate.create(this, onPressEvent);
}
}

public function onPressEvent() {
_root.id=myFid; //Undefined
trace(myFid); //ok
}
}

Main Movie Code:


Code:

on (press) {
var Obj:myClass=new myClass("<A href="http://mydomain/fanbase.xml",_root.viewer">http://mydomain/fanbase.xml",_root.viewer, _root.id);
}
It just keeps saying undefined but yet i seem to be able to trace myFid

Any ideas???

Thanks in advance

Problem Passing Variable Values (from XML) To Variable In Child Movie
I'm reading something from XML, and store it in a variable. I can trace the variable and it shows two items. I can display those two seperately with variable[0] and [1], meaning that it works as intended.

After that, I'm calling a movieclip, which is supposed to read that variable.. sadly, it can't do it. So I resorted to passing the content of the first variable to a variable inside the called movieclip. This works, and tracing the second variable shows both items from the first. However, I cannot access the items seperately with variable2[0] for example.

What's the problem? The second variable is currently a string. I tried to declare is as other things (like xml or array) as well, but that didn't help. Is there also a way to make this procedure unnecessary, i.e. can I somehow access the first variable?

I've attached the fla/xml/swf in case my description doesn't make sense!

Problem Assiging Class Variable To The Main Timeline Variable .... PLEASE HELP
Hi Guys

I just can't seem to solve this problem!!!

I have a random class that generates a random image and an id number from an xml file and a main class that reads information from an xml file according to the id number.

I'm having trouble assigning my random id number from my class to the _root.id variable on the main timeline for my other class to read. I keep getting undefined???

Random Class Code:


Code:

import mx.utils.Delegate;
class randomClass {

public var target_mc:MovieClip;
private var _xml:XML;
private var myTotal:Number;
private var random_number:Number;
public var myFid:Number;
private var myPic:String;
private var myTitle:String;

private var myImages:Array = new Array();
private var myTitles:Array = new Array();
private var myFids:Array = new Array();
function randomClass(url:String, target:MovieClip)
{
target_mc = target;
_xml = new XML();
_xml.ignoreWhite = true;
_xml.onLoad = Delegate.create(this, onLoadEvent);
_xml.load(url);
}

function onLoadEvent(success:Boolean):Void
{
if (success)
{
var i:Number;

myTotal=_xml.firstChild.childNodes.length;

for(i=0; i<=myTotal-1; i++)
{
myImages[i]=_xml.firstChild.childNodes[i].firstChild.firstChild;
myTitles[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.firstChild;
myFids[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.firstChild;
}

random_number=random(myTotal);

myPic="<A href="http://www.mydomain/images/"+myImages[random_number">http://www.mydomain/images/"+myImages[random_number];
myTitle=myTitles[random_number];
myFid=myFids[random_number];

target_mc.title.text=myTitle;

var TheMovieLoader = new MovieClipLoader();
TheMovieLoader.loadClip(myPic, target_mc.new_mc);

var pictureLoaderListener = new Object();
pictureLoaderListener = TheMovieLoader.onLoadComplete()
{
target_mc.new_mc._x=-9;
target_mc.new_mc._y=-5;
target_mc.new_mc._xscale=40;
target_mc.new_mc._yscale=40;
}
TheMovieLoader.addListener(pictureLoaderListener);
target_mc.random_id.onPress = Delegate.create(this, onPressEvent);
}
}

public function onPressEvent() {
_root.id=myFid; //Undefined
trace(myFid); //ok
}
}

Main Movie Code:


Code:

on (press) {
var Obj:myClass=new myClass("<A href="http://mydomain/fanbase.xml",_root.viewer">http://mydomain/fanbase.xml",_root.viewer, _root.id);
}
It just keeps saying undefined but yet i seem to be able to trace myFid

Any ideas???

Thanks in advance

Problem Assiging Class Variable To The Main Timeline Variable .... PLEASE HELP
Hi Guys

I just can't seem to solve this problem!!!

I have a random class that generates a random image and an id number from an xml file and a main class that reads information from an xml file according to the id number.

I'm having trouble assigning my random id number from my class to the _root.id variable on the main timeline for my other class to read. I keep getting undefined???

Random Class Code:

Code:
import mx.utils.Delegate;
class randomClass {

public var target_mc:MovieClip;
private var _xml:XML;
private var myTotal:Number;
private var random_number:Number;
public var myFid:Number;
private var myPic:String;
private var myTitle:String;

private var myImages:Array = new Array();
private var myTitles:Array = new Array();
private var myFids:Array = new Array();
function randomClass(url:String, target:MovieClip)
{
target_mc = target;
_xml = new XML();
_xml.ignoreWhite = true;
_xml.onLoad = Delegate.create(this, onLoadEvent);
_xml.load(url);
}

function onLoadEvent(success:Boolean):Void
{
if (success)
{
var i:Number;

myTotal=_xml.firstChild.childNodes.length;

for(i=0; i<=myTotal-1; i++)
{
myImages[i]=_xml.firstChild.childNodes[i].firstChild.firstChild;
myTitles[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.firstChild;
myFids[i]=_xml.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.firstChild;
}

random_number=random(myTotal);

myPic="<A href="http://www.mydomain/images/"+myImages[random_number">http://www.mydomain/images/"+myImages[random_number];
myTitle=myTitles[random_number];
myFid=myFids[random_number];

target_mc.title.text=myTitle;

var TheMovieLoader = new MovieClipLoader();
TheMovieLoader.loadClip(myPic, target_mc.new_mc);

var pictureLoaderListener = new Object();
pictureLoaderListener = TheMovieLoader.onLoadComplete()
{
target_mc.new_mc._x=-9;
target_mc.new_mc._y=-5;
target_mc.new_mc._xscale=40;
target_mc.new_mc._yscale=40;
}
TheMovieLoader.addListener(pictureLoaderListener);
target_mc.random_id.onPress = Delegate.create(this, onPressEvent);
}
}

public function onPressEvent() {
_root.id=myFid; //Undefined
trace(myFid); //ok
}
}
Main Movie Code:


Code:
on (press) {
var Obj:myClass=new myClass("<A href="http://mydomain/fanbase.xml",_root.viewer">http://mydomain/fanbase.xml",_root.viewer, _root.id);
}
It just keeps saying undefined but yet i seem to be able to trace myFid

Any ideas???

Thanks in advance

About Refreshing The Value Of A Variable Inside Of Another Variable (in A Text Field)
Hello, I have a simple question, but I'm not sure this is possible in Flash:

I'll simplify the problem so that it's easy to understand.

I have a text field holding a variable called "products".

This variable is defined via ActionScript somewhere else, with something like this:


Code:
products = "Some text here" + variable1;


The problem is that, when "variable1" is updated, the value of "products" will obviously remain the same, as it hasn't been redefined (I could redefine it as [products = products + ""] or something, but if I don't include the "variable1" in the definition it won't pick its new value).

I really need to do this with just one text field, and I cannot redefine the whole variable "products" again, as it is much complex than this example and keeps storing info in different ways depending on what the user does.

Any suggestions?
Thanks in advance

How To Store A String Plus A Variable In A Dynamic Text Variable?
Hi,

I've got a dynamic text field with the instance name rightAnswer_txt.

I declare the variable in the frame it resides in, with the following code var rightAnswer_txt:String = "";

Then, when I want to populate it using the following code:

rightAnswer_txt.text = "You scored " + rightAnswers;

the script comes out with an error saying ...

**Error** Scene=Scene 1, layer=actions, frame=7:Line 15: There is no property with the name 'text'.
rightAnswer_txt.text = "You scored " + rightAnswers;

Any idea what this means anyone please?

Variable Scope - Dynamically Created Variable Not Working
Hi all,

For a movieclip obj, I created a dynamic variable and in the onLoadInit handler this variable is not accessible.

This is my code:
--------
var imagesList:Array = new Array("flagGreen.gif", "flagRed.gif");
var path = "images/";

var myMc:MovieClip
= _root.createEmptyMovieClip("myMc", _root.getNextHighestDepth());
myMc.url = path+imagesList[0];

var loader = new Object();
loader.onLoadInit = function(targetMc){
trace( "url1:"+targetMc.url);
trace( "url2:"+_root.myMc.url);
trace( "width:"+targetMc._width);
trace( "height"+targetMc._height);
}

var mcLoaderObj:MovieClipLoader = new MovieClipLoader();
mcLoaderObj.addListener(loader);
mcLoaderObj.loadClip(myMc.url, myMc);

-----------

Image is getting loaded. When myMc.url is passed as a param to loadClip, it is working, but inside onLoadInit it is printed as undefined.

Help will be appreciated. Thanks in advance.

- Kiran

Variable Take On Content Of A Root Variable And Not Its Path - Simple Please Help
Hi there ok my brain has died and fallen off somewhere , what i am trying to do is this:


l=0

l++


_root.advert= "_root.var" + l ;

then i have a text box on stage , dynamic, etc var: _root.advert
, vars are stored in a text file , vars are called, var1, var2 etc , text box needs to display variable contents, but at the moment it just says "_root.var1" etc and not the content s of var1 this is very simple problem but my brains dead please help.

-arran

Loading Variable Smarclip Into Variable Movieclip?
HO HO HO FashMonsters-

Damn, Loading a variable driven smartclip into a movie clip can be a lil' tricky. Problem is I think I need the movie clip to be a variable as well. My button action is calling up my movie clip instances which are referencing the variable smart clip. However, each button action loads a new movie clip atop the previous. I either need to remove the previous movieclip or make the movie clip a variable loading variable smart clips.

Da Dizawg wud LUV some Hizelp!

Dynamic Text Box Variable = Other Variable, No More Scroll
So I have this textbox. And I want it to display some text. And I want the text to scroll and I want the text to change when you click a button. W007 I did it I am done. But I have a little problem, and I do hope you can help.

I loaded variables from a text file into flash, gave the variables different names, and then I set the buttons that can be clicked on to set the dynamic text box variable to equal one of the loaded variables. Ít wouldn't scroll after that. Whats up wit dat.

I can get you the FLA if you want it, but I am hoping someone will just say oh ya, common mistake, you gotta check a box or something.

Make A Variable = A Variable From A Text Document
I'll try my best to explain this, but it might be easier to see the file itself, I zipped it up and can be found at:

DOWNLOAD ZIP FILE
(the flash file is not pretty, I am building the functionality first)

-----------------------------

The variable it is creating does not call up the variable in the text
document.

I have a textfield called: randomquote

the value for randomquote is being "created" by:

Set Variable: "randomquote" = "q"&VARX2

VARX2 is a random number being generated by:

Set Variable: "VARX2" = Random ( VARX )

VARX is a number being pulled from the text document:

Set Variable: "VARX" = (/:myNumber)


SO, If I hard code randomquote with the value q4 , then the variable q4 from the textdocument is pulled up correctly.

BUT, if randomquote equals q4 (generated from a random number) the variable q4 from the textdocument is not shown, but rather just a simple q4.

Passing Array Variable Name In To Component Variable & Getting It's Value
Hi, All
Anyone can solve my problem????
My Problem is that I want to store a array' s name in to a component variable. like this:-

working in this case

Scene action on timeline
_global.arr = "This is aray Test"

component parameters
VarName : _global.arr



Not working in this case

Scene action on timeline
_global.arr1 = new Array()
_global.arr 1[0]= "This is aray Test"




component parameters
VarName : _global.arr1[0]




in component I'm doing this on timeline action
abc.text = eval(VarName)


plz help me out of this

Regards
Ankur Arora

Php Variable -> Actionscript Variable (transfer Without Being Seen By User)
I am trying to secure up the sign up process with something similar to the "type these 6 letters"

the problem is, how to get a value between php(or any server-side language) and actionscript? I only know ways where the variable would be visible to a robot, rendering this extra sign-up step useless.


So I am wondering if there is a way to transfer a variable without it being seen during transfer?

I have a little bit of knowledge about public variable encryption and I know it would work for this but i have never implemented this encryption before. Is there a tutorial that shows how to go about creating a public encryption/decryption algorithm?

How Do I Convert A String Variable Into A Number Variable?
How do I convert a string variable into a number variable?

Thanks in advance.

Garry

Change String Variable To A MovieClip Variable
Hi

I have been banging my head against a brick wall regarding the following problem which must be very simple to fix, just can't see the answer.

I have a class assigned to a movieclip called canvas. The class is called drawClass. I have called the instance of canvas on the stage 'drawingCanvas'.

When I trace "drawingCanvas" I get

[object drawClass]

which is fine. Tracing drawingCanvas.name gets me the instance name

'drawingCanvas'.

This is a String variable.

Basically what I am trying to do is pass the MovieClip name to another class. In my example the class 'toolBar', which can then interact with the MovieClip.

The problem is passing 'drawingCanvas.name' results in a String, so I get an error saying :

TypeError: Error #1034: Type Coercion failed: cannot convert "canvasArea" to flash.display.MovieClip.

I can't for love or money find a way to convert a String variable to a MovieClip variable! I have the name of the MovieClip, I just need to tell the toolbar class. But I can't find a way of doing this as the instance on stage is an object of drawingClass, not a MovieClip (unless MovieClips with attached classes are not treated as standard MovieClips?).

Any ideas are most welcome. I'm sure I am missing something obvious.

Thanks for looking

Sting Variable To Mc Path - VARIABLE TYPES
Hey all Im building a variable like this

var m = "_root.subNav.subNav" + i;

When I do a trace to find the var type it comes back as a string so my function wont execute thinking it is a string and not a path. Does anyone know how to fix this or change the variable type on the fly in AS 1.0? Ive tried:

var m =eval( "_root.subNav.subNav" + i);

But that came back undefined....
Thanks.

Changing Root Variable With Text Variable
Simple question: I'm trying to change the value of a variable on the _root level (called "myVar") to whatever a user types into a text box (mytextvar) on the stage. I have a button that says:

ActionScript Code:
on (press) {
    _root.myVar = _root.myTextVar;
}
It isn't working... any ideas how to make this work?

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