ActionScript 2.0 :: Adding Randomly Loaded Variables Together And More?
Feb 1, 2004
I'm struggling with a project. I'll try and describe it. 10 mc are loaded randomly with one of two ext.swf's. Each time you click/drag on one, 1 of 6 questions are randomly loaded from an array into a text box on the main timeline. I need to count and add up how many of each of the 2 ext.swf's have loaded and whether they have an x pos < or > 300. My first problem is: The question shows up in the text box when the mc is clicked/dragged but when I trace it, the question that shows in the output doesn't match the one that's loaded into the text box?The second problem is a big one. I need to be steered in the right direction as to keep track of what is where on stage. I only have a vague sense of how to go about it, and combining all the bits is too much.
1. I need to trace the question2. I need to say if the question is 'blah' do this3. The 'do this' is pretty complicated. I need to add up the #1 movies that have an x pos of <300 and the #1 movies that have an x pos of >300 and then do the same for the #0 movies. Then I need to compare a users input answer to the correct one!!! The question AS is in the external swf. [AS]stop();
// Questions Array
question = new Array(); {
question[0] = "How many hedgehogs are in the bed?";
so i am having trouble with adding a box randomly on the screen. I have done this before and it seems like it should have a relatively easy solution. But alas, i have not been able to figure this out. This is the info: I have a box mc with exporting as Box. I have a Box Actionscript file with this code in it:
[Code]...
Nothing happens at all but there is no errors. Also i would like to keep everything in the classes.
On my previous post Adding a object randomly on the screen in as3 I explained the specifics of my situation. But I will go over it again. I have a box with a class(not my document class. I do have one called Main but this one is just an AS class referencing my box.) The classes name is Box and my MC box is exported as Box. This is the codethis is in my main file on the main timline
addEventListener(Event.ENTER_FRAME, createbox); var _box:Box = new Box; var boxlimit:int = 2;
How can I randomly create some variables as the movie loads so I'll be able to use this variables as a if statement later on and make the movie play diferent labels?
I am trying to have a streamed mp3 loaded from xml, randomly play a new song on complete. I already have it play randomly onload. Here is what I have, and it doesnt work .
Code: tickerLength = 52; for (i=0; i<tickerLength; i++) { leading += " ";[code].........
I am making a movie quiz game, where a movie clip plays and the user must enter an answer into an Input Field.
My question is:
Can I write/include some actionscript that will allow the Enter/Answer button that I have coded to detect WHICH of my pool of 100 video questions is playing, so that I can assign the correct answer in the actionscript on my Enter/Answer button?
The Code: Frame 1 to load the .flvs randomly:
var videoArray:Array = new Array() videoArray.push("question1.flv") videoArray.push("question2.flv") videoArray.push("question3.flv")
[Code]....
Something I can add to the code on my Enter button that will detect which random .flv is playing?
If not, is there a different logic I need to employ to create this? Perhaps creating independent swfs that contain the video and input field functions together? And if so, how/where will I establish a timer/scoring function?
I am trying to have a streamed mp3 loaded from xml, randomly play a new song on complete. I already have it play randomly onload. Here is what I have, and it doesnt work :
Code: tickerLength = 52; for (i=0; i<tickerLength; i++) { leading += " ";[code].....
i have a text field called Moneytxt and i want it so when u click on a box it somtimes adds 200 and somtimes adds 100 ( also i would like it to add up in numerical value example: if it adds 100 and it has 200 it equals 300 not 200100). I also have penniestxt where sometimes it adds 30 and somtimes it adds 40.
this is the code (box getting added is not included or addeventlistener)
public function boxclick(event:MouseEvent):void { var _box:Box=event.currentTarget as Box; logtxt.appendText(" You collected the box");
I have imported some info from an xml file into my movie. The info from this file is then displayed in dynamic text boxes. Three of these text boxes show a price which displays fine. However i need the contents of these text boxes to be added together in another dynamic text box called total. I need this total to update as the price fields change. I just cant figure it out.
Here is my code which is placed at frame 1 of my movie:
The last line of code is along the lines of how i think it should work
I'm a student web designer from Toronto, ON working on a flash interface for an art show.In our flash file (AS 2.0), I need a piece of code to constantly check a set of variables. If the variable reaches 2, I want it to unload the current movie, therefore I also have a set of buttons which each increase the current variable by +1 every time they are clicked. Therefore once 2 buttons were clicked, the movie would be unloaded.[code]
(Using AS3) I'm doing a simple grid layout of boxes (movieClips), i'm then trying to save their current position to each of the movieClips. So in AS2 i'd do something like ...
obj.origX = obj._x; obj.origY = obj._y;
but it's saying; 1119: Access of possibly undefined property targetX through a reference with static type flash.displayisplayObject. How can i add custom variables to movieClips?
Is there an easy way to add a variable into A HREF tag within as3?Example:var myVariable = "hello";<a href = 'event:myVariable' </a>Of course, that doesn't work, but how would I go about making it work? This is for a dynamic project, so I need to call upon variables within the A HREF in order for this to work.
I meant to call it "Convert a value to a variable". Using CS3, AS2: If I have a variable that's a string value = the name of another variable, can I extract the value and then look for the extracted value's matching variable name to get it's value?
Ex:
color = "blue" box = "color"
(Assuming I don't know the value of box) How would I get the value of "box" out so I could search for the value "color" as if it were a variable? I need to convert a value to a variable name is what i'm getting at... I think.
I meant to call it "Convert a value to a variable".Using CS3, AS2:If I have a variable that's a string value = the name of another variable, can I extract the value and then look for the extracted value's matching variable name to get it's value?[code](Assuming I don't know the value of box) How would I get the value of "box" out so I could search for the value "color" as if it were a variable? I need to convert a value to a variable name is what i'm getting at.
I've created and XML object that's working fine and I want the user to be able to add to the XML dynamically, using an input text field and appendChild() So, what is the syntax to use so that I can put in the text they enter as an attribute of a node of my current XML object? Here's what I've got for adding to the XML (stripped down obviously):
ActionScript Code: var xmlData:XML = new XML(); var clientToAdd:String = userInput.text; xmlData.appendChild(<project name=clientToAdd></project>);
How can I take the variable clientToAdd and make it the attribute "name" of the "project" node?
I've designed an as3 flash banner with 3 input fields. The user fills in these fields and clicks a button. The text from these fields are then stored as variables, which needs to be included in the target url - like this: websitestuff...?a=1&b=2&c=3 This is no problem. However, here's the issue: The banner needs to use clickTAG as it will be uploaded to Google Adwords. I can make the clickTAG part work, but have been unsuccessful in also adding the 3 variables after the url.
Having some issues with some variables not adding together to make a new number. Instead they are appending to each other as if adding characters onto a string rather than a number. Here is my code.
ActionScript Code: var dispenserPos:Object = {x1:"41", y1:"180", x2:"283", y2:"180", x3:"530", y3:"180", x4:"775", y4:"180"}; function randRange(min:Number, max:Number):Number { var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min; return randomNum; [Code] .....
It should be tracing out 388 instead of the numbers appended onto one another.
I've been building a web based order form and my client want the ability to add items (as many as you want) and for them to be totalled up. I've used Kirupas Scrollpane with Dynamic Mc's tutorial to add my products, but I can't seem to add them up! Each product adds up it's subtotal in the dynamically attached Mc and outputs the variable 'subtotal' In my root I have this function to call the subtotals, but I can't seem to get it to add up each of them to output a total...
If I want to add or substract number variables, how can I name them to indicate they are numbers and how can I do basic math with them? If I try adding common variables like
_root.answer = _root.var1+_root.var2; and if var 1 is = 1 and var 2 is = 2
I have an application that reads a PHP script and populates the Flash applets using the following on frame 1:
[Code]...
A combobox (created with the returned data) is created on frame 61. When a selection is chosen in the combobox I need to add the value returned from the combobox to the variable catvar, add this variable to the LoadVars object and run the script again. It seems to set c.catvar initially but when I use the 'sendAndLoad command the second time c.catvar isn't included. Is it possible to add variables to a LoadVars object created on frame 1 from frame 61?
I'm building a Flash banner (as3) for AdWords, but I can't find in their documentation whether it is possible to add hash or querystring variables to appear in the eventual target url when u are using a clickTAG. Ideally I would like to use both. For example, my banner has four input fields and I would like to build my target url thusly:
var base:String= "http://www.example.com"; var qs:String= "?one=" + input1.text + "&two=" + input2.text; var hs:String= "#three=" + input3.text + "&four=" + input4.text; var targetUrl:String= base + qs + hs; flash.net.navigateToURL(new URLRequest(targetUrl), "_blank");
Is this possible with AdWords while using clickTAG?
I have a .fla which loads thumb nails and when clicked shows the large image. It all works fine. I would like to have a reflection for each thumb how would I go about doing this, or how would amend my code to add the reflection.
Code: var holder:thumbNail = new thumbNail(); var thumb:Loader; var container:MovieClip = new MovieClip();
I'm trying to create a portfolio with ten images that I needto be loaded and added on the stage.The problem i not to load theese images or adding themdirectlyt on the stage, but I want them to be added inside a thumbthat I've created as a movieclip.I've also created a for...loop so the thumbs dynamically areadded on the stage. To access them I've given them an instance-nameusing [object].name = "[name]" and I've also created an Array tokeep track of the names.