I have been using Actionscript 3.0 in Adobe Flash Builder for a few weeks,and I really like it! Bare with me because I'm not really good at it, yet. Anyway, I was wondering how would I go by adding up odd numbers from an array of numbers? I know how to make all of the numbers add up, but adding only the odd numbers I'm not so sure how to do it.
The Setup: For each movieclip the hittests a set of "target" movieclips an array is given a value. If mcIcon1 is dropped onto mcTarget1 the first number in the vacant array is given the value of one. The Issue: If I remove mcIcon1, for example, from the mcTarget1 movieclip I can't find a way of just removing the 1 from that array without the rest of the array numbers being reset.
I have about 12 dates that scroll in when a certain date button is pressed.For example: 1976, 19991, 2001 etc.Each section is abut 941 pixels wide.So, If I have 10 dates, that's about 9,000 pixels wide.
So I have this text field that I am able to transform, AND I want it to stop at a certain width. The width I want it to stop at is the longest word in a text field. Essentially stopping the text from wrapping around and cutting the words in half or splitting them up. In theory if you set the width of the text field to low enough it would have a word on each line, but would never cut the words up.
This text field has a TextFormat attached to it by the way. AND so far the only idea I can come up with is to create a second textfield hidden away and put the longest word (not sure how you'd get that) into that field and measure the width. What I'm wondering though is if there is anything in possibly the getBounds method or something simular that does this already!?
URL...Basically I would like the loaded jpg to center and scale to it's longest side within the stage. So a portrait shot will stretch 100% from top to bottom but might have bars on either side. A landscape shot might letterbox if it is short enough. However, if the landscape shot is too tall, the top and bottom would bleed off the screen.
I'm debugging some code and see a loop where an event is dispatched and a remote call is made for every record.Everything was working fine until there were several hundred records (700) to be a exact. Is that going to make the flash player chug? Should I move to a queued system? How many records is too many? [code]
I want to push a button, and play through the entire array one sound at a time. When the first sound stops, the second begins, etc. all the way until the last sound plays. When the last sound finishes, all sound should stop, and if you push the play button again, it should start over at the beginning, and play through all sounds again.
I'm thinking the SOUND_COMPLETE needs to be used... I'm just not sure how, hence the empty function. I only want to have to push play one time to hear the entire array in a sequence.
var count; var songList:Array = new Array("test1.mp3","test2.mp3","test3.mp3"); count = songList.length;
I want to to load a series of swf files into a scene sequentially. I stumbled onto some Actionscript 3.0 code in this forum that accomplishes this.
var a:Array = new Array("1.swf", "2.swf", "3.swf");var l:Loader; function didLoad(e:Event){addChild(l);doLoad();} function doLoad(){if (a.length) {l = new Loader();l.contentLoaderInfo.addEventListener(Event.COMPLETE, didLoad);l.load(new URLRequest(a.splice(0,1)));}} doLoad();
Unfortunately, I also want to be able to load the swf files into movie clips in the scene. This code doesn't do that. It loads the swf files on top of each other sequentially. I want to be able to position the swf files side by side. how to tweak the code to load the swf files into movie clips in the scene.
I can't seem to make it work. No matter how much I play with it:
[Code]....
I've since lost contact with the person assisting me. I've read up on arrays, and I don't think that this is my problem or why I can't get my head around it. Maybe its the loop?
I like to keep my timelines compact, so I often have several graphics in a single layer. Let's imagine that I have a series of five keyframes, with four shapes in each one. Over the course of those five keyframes, one of the four shapes changes into a different shape. Now, let's say that I realize that one of the static shapes needs to be something different. "Oh no! That circle shoudl be a triangle instead!".
I know how to use Edit Multiple Frames to drag a box around that shape and delete it across those keyframes, but there are a few problems with that.One is that if the keyframes are really long or I have more like 30 or 40 keyframes in which I want to make this change, I have to drag and scroll and drag and scroll the shaded part of the playhead to cover all the of the keyframes or be willing to do it in chunks. Also, if the thing I want to delete is sitting on top of something else,then I can't drag a box around it without selecting that other thing. I could click the object and delete it, but that only deletes it from the right-most keyframe. I then have to click and delete for every keyframe.
All of this is secondary to the fact that Edit Multiple Frames doesn't seem to allow you to paste something into all of those frames. At least, not any way I can tell. I suppose this is a sade-effect of not assigning every asset its own layer, but that would get almost unmanageable with some of the projects I work on.if there's a way to paste things into multiple/successive keyframes on the same layer?
I am attempting to fire successive actions from the same button by setting different variables throughout the process like so...(using Fuse to animate)
var spotOne:Boolean = true; var spotTwo:Boolean = false; var spotThree:Boolean = false; var spotFour:Boolean = false;
I have pressed the buttons in a array. The objective is press the buttons in the correct sequence. Correct sequence click "btn1 and btn2" or " btn2 or btn1" Correct sequence click "btn3 and btn4" or " btn4 or btn3" Inc correct sequence click "btn1 and btn4" or " btn4 or btn1" and so on.
I've place a trace the button is returned undefined. ActionScript Code: var buttonArray = new Array(btn1, btn2, btn3, btn4); var clicks = 0; for(i =0; i < buttonArray.length; i++){ buttonArray[i] .onPress = function(){ trace(buttonArray[i] + "click"); }}
created a new textfield(digitC) I want to use again and again. First time thru, I applied an animation to the text object that scaled it down to half size. the next time I use the textfield I want to reset it to its original size.
I tried resetting the textFormat to the original font size and reapply to format to digitC. But digitC retains the half size font. How do I reset digitC to original size?
I am using below code to load images from array, which works fine. My unsolved question how do I put all the images after it has been loaded to holderMc_animation (which in in root, with instance name holderMc_animation)...is sequence order? image 1 goes to keframe1 of holderMc_animation and image 2 to keyframe 2 of holderMc_animation and so on...
I would like to implement an inspection time task using Actionscript. The idea is to dynamically change the time interval between masked and unmasked images based on user responses. The "inspection time" is defined as the interval at which the user achieves certain accuracy. There are various factors affecting the accuracy of that interval: monitor refresh rate, flash vm frame rate, Timer event accuracy, render time. Anything else? How do I determine the actual inverval the user sees? High accuracy is required, since typical performance is from 20 to 80 msec on that task. I assume the limiting factor is the monitor refresh rate. If it's 60Hz, I would only be able to increment by 16.7msec.
I'm curious and I know there are many ways, but anyone have a good solution towards adding up the numbers in an array minus it's current node?If I am at myNumbers[3] for example, how do I add everything to the left of my current node such as myNumbers[2], myNumbers[1], myNumbers[0]?var myNumbers:Number = ["123", "45", "111", "54"];
So my array contains marks for a ficticious class and i need to be able to calculate these marks to give me a class average which is this formula; all marks added / number of marksIs there a way to do this within an array?
My code for the program so far is: // Create Arrayvar marks:Array =["100","76","80","54","23"];// Button Functionenter_btn.addEventListener(MouseEvent.CLICK, onClick); function
As the title says I am looking for a loop sequence to search through my array and find values that are even and then calculate them with a button click. I have this code which is completely wrong:
I have an assignment where I need to create an array with 9 numbers between 1 and 34, also none of the numbers need to appear twice.This is what I have so far, so as you can see I'm stuck on the part where I have to check if the number already exists in the array.[code]
[code]I have information coming in from an XML page. One of the childnodes is an ID. The numbers of the IDs go from 29 to 40. I'm trying to have 6 numbers randomly grabbed from the list, so I made a function to find a random number between a given "Low" and "High" numbers, then another to continuously add 1 if it's already one of the other numbers(I'm pretty sure the method of that part, I could have taken a short cut.)Where it says to trace the two numbers near the top of the find5RandomNumbers function, they trace 29 and 40. But near the bottom where it's told to trace all 6 items, they come back as "NaN."[code]
I'm trying to create an array of random unique numbers from 0 to 39 so that I can list these numbers in a countdown and without repetition, ie: 25, 29, 11, 03, 17 etc. These are 40 different numbers, equal or greater than 0 and equal or less than 39.
How do I add array values that are numbers when loaded dynamically via sql?Example script doesn't calculate. Instead it just adds as though the elements of ycor array are string based. So ycor[0] = 2 and ycor[1] = 3 added equals 23 not 5. Of course these elements are being dynamically set via mysql db that generates a xml table. I've left out file locations and passwords for obvious reasons. Why are the elements being treated as strings?
Code: var theXML:XML = new XML(); theXML.ignoreWhite = true;[code].....
I'm trying to get the 255 smallest numbers from an array made up of all the alpha values in a given BitmapData, and storing these numbers in the Alpha array for paletteMap().We all know how to get the smallest/highest number from an array, or to delete repeating numbers or even to average numbers inside an array. I've been tweaking for 2 days with these possibilities but unfortunately I can't find anything satisfactory.
I am using actionscript 3 and I am creating an array of 16 buttons and need to use the function math.random to get it to pick 5 random unique numbers out of the array. As at the moment it is sometimes picking 5 unique numbers and sometimes it has duplicate buttons appearing?
I have an Array of objects that each have a Name and a Score. I can sort the Array with '.sortOn()' by the object's Name or the Score, but when I sort by the Score, if some Names have the same Score, they don't list Alphabetically within that Score. The following code shows what I mean. The Names with a Score of 50 are together when listed by Score, but they are not Alphabetical. How do I combine both ways of sorting?
I've got this code ActionScript Code: package uk.ac.uwe.multimedia.lottery{ /* There are 3 new MCs 1. The instructions "Click here..." 2. An MC with the 2 text fields myText 3. An MC with the 6 input text fields */ import flash.display.*; [Code] .....
Everything works fine until I click on the 'submitButton'. When I click on it nothing at all happens, even though what I want to happen is for the error messages to appear if there is a problem, or if there isn't a problem I want the numbers to be added to the array.
am developing an application which requires a consecutive searching side to it. Basically, I need a function or a class which takes an array as the parameter, and return the possible 3 consecutive numbers in a 2 dimensional array.For example, if I have this code:
ActionScript Code: //Global array var glob:Array=[0,1,2,3,4,5,6,7,8,9];