ActionScript 3.0 :: 2 Dimension Arrays - It Shows Up As NaN Whenever I Hit The OnAverage Button?
Feb 2, 2010
I have an array file with data that has 4 sets of numbers within each array. I need all four numbers in whichever array gets chosen to be added together and divided by 4 to take the average of the 4 numbers. So fare I have this:
Code:
function onAverage(event:MouseEvent):void
{
var studentIndexF:int=-1;[code]....
Right now with this it shows up as NaN whenever I hit the onAverage button.
View 1 Replies
Similar Posts:
Dec 16, 2010
The issue I'm having is that I have a main "wrapper" 100x100 (but it could be any size) - it's just there to hold and display whatever content, swf, gif, etc we may want to throw into it. As long as the loaded content doesn't have 3D animation like rotationY going on, it displays fine. But when it does, the 3D "anchor" properties (like projectionCenter) of the loaded swf inherit those of the main timeline (i.e. 100x100 (main) vs 728x90 (loaded)). If I change the dimension of the main "wrapper" in Flash IDE to match what's coming in - the 3D behaves fine, but I won't know what the dimensions of the content will be until it comes, so I need a way (if there is one) to dynamically alter the main "wrapper" or root display object through AS. Stuff like "this.width = loader.width" or "stage.width = loader.width" or "root.width = loader.width" etc doesn't work. Flex has the hBox and vBox
View 1 Replies
Jun 30, 2011
i use as3 to change image in graphic file, and my graphic file is used by a button, how do i refresh the button to let it shows new image?
View 1 Replies
Feb 14, 2010
I'm making a flash order form with Action Script 3, and I can't figure out how to make a button which does this:
1. You click on the 'nextbutton'
2. Frame 2 is shown
View 2 Replies
Nov 14, 2006
why only the last mainNav button shows up on stage? Tell me if you need more info.
Code:
function createMainMenu() {
var a = 1;
var total = mm_array.length;
[Code]....
View 2 Replies
Aug 11, 2010
I am loading an external Movie via FLVPlayback, after the movie has played - the REPLAY button shows up. Everything works except the REPLAY button shows up for a couple of seconds before the movie starts playing. I'm thinking that it's because of my 'If' statement, which checks if the movie is PLAYING to show(or hide) the replay button.. I'm super new to AS.[code]...
View 1 Replies
Aug 11, 2010
I have a bit of a problem.. I am loading an external Movie via FLVPlayback, after the movie has played - the REPLAY button shows up. Everything works except the REPLAY button shows up for a couple of seconds before the movie starts playing. I'm thinking that it's because of my 'If' statement, which checks if the movie is PLAYING to show(or hide) the replay button.I'm super new to AS..how I can change the 'if' statement to look weather the movie is loading or playing.! Here's the code:
import fl.video.*;
replay_btn.visible = false;
var myVideo:FLVPlayback = new FLVPlayback();
[code].......
View 0 Replies
Mar 18, 2011
I have a problem with a clear interval command that only half works,when i select the the high button the interval clears but when i reset the high button the interval starts again,also the interval does not stop when the low button text shows low.I get the trace action but no clear interval.
Code:
auxcont=function(){
if(high_txt.text=="reset"){
clearInterval(myInterval);[code]....
on low system circulates between pump on and off.on high system is in high mode .
View 3 Replies
Aug 1, 2009
I want to create a button that when clicked it shows a good looking box with a swf or an image inside. I've tried looking for a tutorial for something that resembles this, but couldn't. The closest thing I found were tooltips, but that's not what I need. The tooltip disappears and it's not meant for UI.
View 2 Replies
Jun 24, 2004
I've got this following scripts to create button through action script. However during onrollover/onrelease, the text (button name) is dissapear.Here's the code:
Code:
depth = 1;
mouse_over_colour = 0xCCCCCC;
mouse_clicked_colour = 0x666666;[code]....
View 7 Replies
Dec 10, 2010
I have a button on the main timeline that works fine, part of the code in the button:
for (b=1; b< dpth; b++) {
var lineMovedx = _root["Line"+b]._x;
_root["Line"+b]._x = lineMovedx-9000
trace(_root["Line"+b]);
It basically moves stuff a person draws off the screen when the button is pushed, there is another button that brings it back. But when I put that same button in a movieclip on the main timeline and change the code to this:
for (b=1; b< dpth; b++) {
var lineMovedx = _root._root["Line"+b]._x;
_root._root["Line"+b]._x = lineMovedx-9000
trace(_root._root["Line"+b]);
It no longer works and the trace shows no output, it basically loses it completely, I can't figure out why it does not work, it seems so simple.
View 1 Replies
Jun 24, 2004
I've got this following scripts to create button through action script. However during onrollover/onrelease, the text (button name) is dissapear.
Code:
depth = 1;
mouse_over_colour = 0xCCCCCC;
mouse_clicked_colour = 0x666666;
area_width = 200;
[code]...
View 7 Replies
Mar 15, 2009
I am trying to get when a user mouses over the button some content shows up and moves with the mouse until that user moves off the button..does anyone know how i can acheive this...
View 13 Replies
Mar 4, 2006
I just tested out my site in Firefox and IE. Everything works the way I want it to in Firefox but in IE I'm having trouble. When I click on a button my preloader shows up but doesn't stop to load the content, it plays straight through and then my movie pops up. Does anyone know why this might be happening? I've never encountered this problem before.
[url]...
Web Design, Illustration, Resume and Downloads are all I have working so far.
View 4 Replies
Aug 13, 2010
I'm trying to create a simple banner ad where the mouse hovers over the button and a panel shows up over some content of the site.[URL]I have two different .swfs: the container, which is the button and a loaded swf that has the animation that comes up when the button is clicked. The button is only 183 x 40px where as the loaded swf is 183 x 160px.When the loader swf is loaded, it takes the dimensions of the button.
Is there a way to have the loader swf be its original dimensions, so when the mouse hovers over the button, the loader swf covers some of the content on the Web site?Also, how can I change the MouseEvent to load the SWF when the mouse is only over the button and not clicking?
The simple code I have so far:
stop();
var myLoader:Loader = new Loader();
open_btn.addEventListener(MouseEvent.CLICK, loadBanner);
[code]....
View 1 Replies
Jul 17, 2011
I'm running FMS 4 Dev on my win XP SP3 machine, also running flash cs5 professional on same machine. I get the server admin screen to come up and it says it's running. I'm using a tut book on FMS and trying to run the first script in the book. It's long but I'll add the script at the bottom so you can see what i'm doing. In the server app folder I placed another folder called vid2 with nothing in it just like the book told me to do. I wrote the script line for line out of the book. When I test my movie it lays out my video window and buttons. It diplays my ugly mug on the screen. when I press the record button it does nothing. when i press the stop button the output window shows me an error of "#1009 can't access properties or methods of a null object". I assume that this is telling me I do not have a net connection.
when I types in the example it had an IP address in the code.How do I know the correct IP addy to my dev server? If I'm doing development and testing on the same machine do I even need to know this? 2) How will what I'm doing now differ from leasing space from an FMS provider?
the script:
package{ import fl.controls.Button; import fl.controls.TextInput; import flash.display.Sprite; import flash.net.NetConnection; import flash.net.NetStream; import flash.events.NetStatusEvent; import flash.events.MouseEvent; [code].....
View 2 Replies
Feb 8, 2010
Basically, I have a FLVplayer called vidPlayer and 3 dynamic text fields that put text in when they are clicked. I want to be able to keep the button clicked in the 'over' state, and to do this I believe arrays are needed? Also, an array might be easier, as there is a lot of code to sift through. below is the code for the buttons in my flv;
[Code]...
View 1 Replies
Jul 28, 2009
I have a project where I have 80 or so invisible buttons, that when clicked, need to load a movie clip from the library into a mc on the stage, as well as cause a rollover and rollout state on a "movie clip button" that's sitting underneath the invisible button. This is in ActionScript 2.0.Here's a example of one of my button actions:
ActionScript Code:[code]....
The way it works is "invis_1_1" is the first invisible button in a group, the 1_1 refers to the button being in the first column and the first row in a grid. The "movie button" it's controlling is "col1row1" which has a "on" and "off" state. When the invisible button is clicked it loads "1_1", which is a movie clip in the library, into a holder movie clip.The dilema I'm running into is I'll need to write this code over 80 times with a slight change each time to the instance names etc. I'm sure there's a way to do this with an array but I'm still new to using arrays.
View 4 Replies
Dec 15, 2006
I am making a portfolio for my website and here is the beginning of my script.
stop();
//setting up the list of frame names for the buttons
imagelist = ["horror","legs","chair"];
//'next' button setup
next_b.onRelease = function() {
gotoAndPlay (imagelist[0]);
}
Now I want the button to cycle through the arrays so that everytime you hit the button it goes to the next frame instance that I've named. In this case imagelist[0] is horror so next time you hit button I want it to goto imagelist[1] or 'legs.' Also I need to set a stop action for this (I am guessing loop) so that it stops at the array length.
View 4 Replies
Feb 23, 2010
I have a character, And in its movieclip I`ve got 3 frames (first has an idle pose, second a walking pose and third a running pose), each with a movieclip with an action in it.Well, what I wanted is that when I am walking with this character, and press the SHIFT key he runs.And I`ve got the following code
if (Key.isDown(Key.LEFT))[code]....
But when I click the shift button, he shows the first frame static of the movie clip in frame 3 (running frame).
View 9 Replies
Jul 23, 2009
how to use an array to create a back button for something I've made in Flash. I wish it was as easy as making the back button go to the previous slide, but there are several branching scenarios where that scenario won't exactly work. I purchased a membership to Lynda.com in order to try and learn AS3, but the section they have on arrays in AS3 doesn't come close to teaching me what I need to know for this kind of operation.
View 1 Replies
May 31, 2011
I'm trying to make a simple demo that works.
Basically, I have 4 Mcs on the stage. The same Mc with 4 instance names. Each Mc is a hole, and on frame 2 a bee appears. The 2 states of the Mc are:
frame 1, label: 'start'.
frame 2, label: 'action'. (a bee appears).
Here's my code so far. It works without errors so far, but I hope the arrays are setup right. What I'd like to happen is:
1) When the user has clicked on 4 holes in any order, the 'welldone' box appears. code to insert: addChild(welldone);
2) Since the order is random, I have a dynamic text box at the bottom of the stage. I'd like the words: one, two, three, four.. appearing in the textfield in that order.
It could be very simple or quite complex
var welldone:MovieClip = new Welldone();
var clipArray:Array = [hex1, hex2, hex3, hex4];
for (var i:int = 0; i < clipArray.length; i++) {
[Code].....
View 14 Replies
Feb 8, 2010
Basically, I have a FLVplayer called vidPlayer and 3 dynamic text fields that put text in when they are clicked. I want to be able to keep the button clicked in the 'over' state, and to do this I believe arrays are needed? Also, an array might be easier, as there is a lot of code to sift through.
Below is the code for the buttons in my flv;
Select all//video player script
function fenwick(event:MouseEvent):void{
vidPlayer.source = "flvs/adver/Fenwick.flv";
}function moneyshopGold(event:MouseEvent):void{
vidPlayer.source = "flvs/adver/MS_Liquid_Gold.flv";
[Code] .....
View 1 Replies
Jul 6, 2004
i m doing a program which contain few text. When i click a button,'step 1' text will be view. When i second, 'step 2 ' text will be load out and 'step 1' text is still in the stage.. the method i m using is array.i put my text in an arrays.
View 9 Replies
Jan 21, 2011
I am running into some trouble adding an array into another array to create a multi-dimensional array.The code appears as below:
var slideDataArray:Array = new Array();
var slideShowDataArray:Array = new Array();
slideDataArray[0] = xmlData.SlideShowParameters.SlideShowImagesDirectory;[code]........
I am looking for a means of placing the slideDataArray into a 'slot' or value of slideShowDataArray so that I can in the end pass the slideShowDataArray as a parameter to another function.As of now, the last slideDataArray appears 11 times (the loop runs 11 times) in slideShowDataArray and the way the code is written the slideDataArray is unique every iteration of the loop.
View 1 Replies
Jul 19, 2005
how do you set a print button so that it does no show up in the print out?
View 1 Replies
Mar 10, 2012
I have an Arrays that contains the names of MovieClips:
Code:
var MyMCs:Array = ["A","B","C","D","E"];
The actual MovieClips names are "MC_A", "MC_B", etc..., I use this method so I reuse the same Array for multiple tasks, I simply add what ever it's needed to the name to match the task at hand. On this case I add "MC_".
Then I have multiple Arrays, with the same names of the values of MyMCs. The values of each these Arrays are the names of buttons that are inside the movieclips of MyMCs:
Code:
var A:Array = ["RR","TT"];
var B:Array = ["YY","UU"];
etc...
I could add a listener to a button this way:
Code:
MC_A.YY.addEventListener(MouseEvent.CLICK, DoSomething)
My problem is that i want it to be done dynamically, using the Arrays values in a loop to add Listeners to the all buttons. The loop system is not a problem for me... my real problem is in the dynamic attribution itself.
Here is what I have:
Code:
//'i' and 'j' have previously been created
for(i=0; i<MyMCs.length; i++){
for(j=0; j<this[MyMCs[i]].length; j++){
[Code]....
I know that this is correct since I tried them separately and I can trace the proper values.
I know that my problem is in the "this" since I get an error message stating:
1084: Syntax error: expecting identifier before this.
I suppose it should state something else... I tryed with "root", "parent", "child", "MovieClip"... with no luck...
View 2 Replies
Aug 26, 2009
I've got a bit that loads a big chunk of xml data about products.I push product info into an array(e.g. productArray), then add that array to another array (e.g. allProductsArray)How do I sort those arrays? For instance, if I want to sort the allProductsArray based on the info in productArray[0]?Alternatively, would something other tha an array of arrays be a better route?This loader loads the same sort of info for many different clients, so the bit to sort on will change.
View 5 Replies
May 30, 2011
[Code]....
I'm stucked here. I want the font type "BauhausMedium" to apply when ft_01 is clicked, font type "Haettenschweiler" to apply when ft_02 is clicked, etc... at the same time I want all" ft_01a", "ft_02a", "ft_03a" movieclips to hide except for the movieclip similar to the clicked button. E.g. if "ft_02" was clicked ft_02a to be visible =true and rest to be visible = false (ft_01a, ft_03a).
View 5 Replies
Sep 26, 2011
I'm trying to write a function where I can specify any amount of array, and the return value will be an array containing the contents of all of the specified arrays.I've done this, but it seems like a really slow and ugly way of doing it:
var ar1:Array = [1,2,3,4,5,6,7,8,9];
var ar2:Array = ['a','b','c','d','e','f','g','h'];
function merge(...multi):Array[code].....
Is there an inbuilt and more efficient / nice way of achieving this? The result does not need to be in the same order as the input - completely unsorted is fine.
View 3 Replies