ActionScript 3.0 :: Event For Loop Causing Undefined Array
Mar 11, 2011Basically when I put the asteroidXlocation in a for loop it becomes undefined outside it. If I just do the line by itself it works.[code]...
View 1 RepliesBasically when I put the asteroidXlocation in a for loop it becomes undefined outside it. If I just do the line by itself it works.[code]...
View 1 RepliesI'm an AS2 convert and struggling. I can't figure out how to get my function to see my array. I keep getting an error that "i" is an undefined property.
var thingsToShrink:Array = new Array(
b1,
b2,
b3,
b4,
b5
);
function shrinkBars(myArray:Array){
for (i=0; i < (myArray.length); i++){
myArray[i]._yscale = 0;
}};
shrinkBars(thingsToShrink);
Im using hitTestObject to start a mc playing, but it continues to loop even though there is a stop(); on its last frame.
]Code]...
The mc "rolly" is the one being looped. Its animation is within itself (hope that makes sense) it is not looping the main timeline.
I've just upgraded to CS4 from CS3, and the AS3 project I'm working on which was compiling perfectly well in CS3, is now failing to compile because of a variety of errors.I can solve some of them by casting:
ActionScript Code:
// before
if(clip.stage != null)
// after
if(DisplayObject(clip).stage != null)
But I'm failing to solve them on errors regarding Arrays:
ActionScript Code:
// measurements is an array in both cases
measurements = measurements.splice(index, 1);
// 1180: Call to a possibly undefined method splice.
for(var i:int = 0; i < measurements.length; i++)
// 1202: Access of undefined property length in package measurements.
I'm surprised than a fresh install is behaving like this. Is there some setting somewhere I've not enabled?I set the flex sdk path to the same one that I'm using in Flash Develop, but no luck.
I can't seem to figure out how to get my slideshow to stop looping after I imported an external video. It will no longer stop at frame one, it simply plays all the way through the frames with no pause even though I have a stop(); on each frame.
The file functions properly until I added the FLVPlayback component. It was looping even when the FLVPlayback component was in the library and exported for actionscript and in frame 1. After unchecking these boxes it won't loop, however that all changes as soon as I drag an instance of the component on stage or inside a movie clip on stage.
The flash presentation I'm working on is designed so 1 frame is one slide and I need the video to be playable from 1 slide (frame). Even after placing stop actions everywhere I could think of it still loops straight through with the FLVPlayback component.
I have posted this question recently and I am desperate for a solution. I have a pre-loader which is causing a continuous loop.
On frame 1, I have:
totalK = getBytesTotal()/1000;
loadedK = getBytesLoaded()/1000;
remainingK = totalK-loadedK;
[Code].....
I have some simple code:
function testing(){
for (a=1; a<=4; a++) {
this["btn"+a].enabled = true;
}
}
If i run this function from anywhere it works fine. If i run this function from myTimer = setInteval(testing, 3000); it will not work. If i add other random code into the function it (the newly added code only) will work. So i have narrowed it down to something about this["btn"+a].enabled = true; specifically that is causing it to not run.I really hope this makes sense, appologies, it's 3am :
A script on my page is causing an infinite loop in FireFox. Here is the Javascript:
function expandMothersRings(new_height) {
window.scrollTo(0, 0);
$('#mr-container').animate({
height: new_height
}, 100, function() {
// Animation complete.
});}
This is being called via ExternalInterface from a Flex object:
var tiles_height:Number = 175+Math.ceil(MothersRingData.getInstance().styleArrayCollection.length/4)*175;
ExternalInterface.call("expandMothersRings", tiles_height + 300);
There is no issue in IE or Chrome. But for some reason the expandMothersRings function is infinitely looping in FF. The flex object is not expecting any return value from Javascript. Also if I change the JS function to look like:
function expandMothersRings(new_height) {
alert(new_height);
}
Then it only executes once. So something in the function is causing it to loop in Firefox.
I've been working on an AS3 project. One of my classes in this project is a collision object that extends MovieClip. It is used to be placed in other movie clips as hitboxes.My problem with the code lies in its hittest function. Occasionally, it causes an infinite loop that crashes the program. Flash tells me the problem lies with the getBounds function, but I don't understand why that is so. Can anyone tell me what might be wrong with it?
Code:
public function HitTest(other:CollisionShape,offsetX:Number = 0,offsetY:Number = 0):Boolean {
[code]........
I have a function that once called creates some new variables
function createPane(event:Event):void
{
var manager:IPaneManager = map.getPaneManager();
[code].....
I have just added a menu screen to my game and I get the following error:
ActionScript Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at MyGame()
[code].....
I can successfully read in my xml file and distribute its parts as I please, but upon realizing that I would need to include things like line breaks, I made some changes and it all went up in flames. Here is a bit of the xml.
Code:
<news>
<entry date="June 20, 2007">
<heading title="My first entry!"></heading>
[code]....
I set the htmlText to true for all the text fields that are being influenced, and as long as I don't include any html tags in the xml file, everything works fine. But, as soon as I add something like "<p>", I get "undefined" for all the variables taken in from the xml. Even if I just put one tag in the body, it causes problems with the heading and image.
I have a flash file and am using google's suggested method for as2 event tracking like so:
getURL("javascript:pageTracker._trackEvent('Refferal', 'Join', 'Benefits for HCAs/APs');");
The problem is that instead of silently communicating, pageTracker._trackEvent() appears to return a boolean value. Every time I click the button which this is located on I leave the page I was on and end up on a page that just contains the word "true".how to get around this? It makes the flash unusable.
On very slow machines (>p200Mhz) I sometimes get an error that says "A script in the movie is causing macromedia flash player 6 to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?" Yes, No.
I have a loop function that populates a listbox, sometimes the file it loops from is over 2000 lines, and takes a long time for the listbox to populate. In this time I get the error. If I hit No on the error everything works just fine. I am almost for sure there is no problem with my script, flash just thinks the loop is set to infinity or something and pops open the error box.
Dear community, i am searching for 6 days for a solution but i couldnt find. I installed the trial version of Adobe Media Server 4.5. I am trying to host live stream and it is working without error. but when i activate protection (PHDS), server gives en error code: 20...
Here is the server log...
After i could take the Live HDS, i made these settings as described at [url]
My application.xml and event.xml files are:
This one works really fine, but... the first value is undefined...
var thumb_spacing = 80;
circlecenterX = Stage.width/2;
circlecenterY = Stage.height/2;[code]......
I keep getting "access of undefined property event"Cant seem to figure it out and im guessing its something small...
private function onkeyboardDown(Event:KeyboardEvent):void
{
switch (event.keyCode)
{
[code]....
This is my code :
package { import flash.display.*; import flash.events.*; public class Sample extends MovieClip { public function Sample():void { var c:Rreth = new Rreth ; c.x = 275; c.y = 205; c.buttonMode =
[code].....
The problem is, however, that I'm a super-noob when it comes to flash (done it for a total of a day now) and I simply do not understand the solutions that are given, and the ones that I do understand don't solve the issue.
Alright: I'm trying to make an object (more specifically a circle) move upon command, yet I keep running into this error: "1120: Access of undefined property event." As I've understood it this error has something to do with the object being a null value.
Code:
circle_mc.addEventListener(event.ENTER_FRAME, moveCircle);
function moveCircle(event:Event):void[code].....
I want to loop through an array and use the array value to reference a variable.
The Setup:
(For illustration only. Not actual script)
My MCs:
triangle_mc
square_mc
[Code]....
ActionScript Code:
var answerArray:Array = ["3", "2", "5", "3", "2"]; //these are the correct answers
var answeredArray:Array = ["3", "1", "1", "3", "2"]; //this is an example of what the user
[code]....
So i have my items that I bring onto stage with my loop function with dynamic text fields within the loop. If I want to clear these items using a reset button on the stage how can I do this. From my code below when I press the reset button I receive: TypeError: Error #1010: A term is undefined and has no properties.So a little snippet of my code just to give an idea what I use to bring items to stage and what Im trying to use to reset[code]....
View 4 RepliesI am working in Flex Builder 3 and I am trying to figure out this error. The error console reads "Access of undefined property EVENT." I am not understanding why this error is showing when I have already imported flash.events.Event. Flex is not recognizing with even the hinting helper pop up that appears when I type the addEventListener(It should appear after the opening parenthesis right? Also, I cleaned the targets and still no luck.
[Code]...
Since I'm currently learning Flash with no previous knowledge of any programming whatsoever, I run into problems. A lot. SO, instead of making a new thread every other day, I thought I'd collect them all in one place.
Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, myOnPress);
function myOnPress():void{
if (event.keyCode == 39) {
trace("Pressed");}
}
1120: Access of undefined property event.I guess I just don't understand what it wants from me. Could someone explain this to me a little? I follow tutorials to the letter and still get a lot of little errors like this. Am I missing something obvious?
I'm having problem debugging this line of code : Source: "xmlData = XML(event.target.data); " Error: Access of undefined property event Its actually a lab exercise which I just copy and paste but unsure why it gives me error. I have already declare the variable xmlData [ var xmlData:XML = new XML(); ] , but I dont understand why its still returning an error.
[Code]...
Actionscript code is on frame 3. When compiled will link you to the error. Running on CS4.
I have the following code on the timeline, but when I try and output date_string from the Slider_Tracker array it says it is undefined.
var Days:Array = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday','Saturday');
var Months:Array = new Array('January', 'February', 'March', 'April', 'May', 'June','July','August','September','October','November','December');[code].....
I have my grid-array in my flash game that has a set sized index in it, and through some code it sometimes checks outside of the Array index. Is there a way I can check to see if a index slot is undefined/existent
Gives me a TypeError #1010
public function fnPopulate(X:int, Y:int, Grid:Array){
if (Grid[ X + 1 ][ Y + 1 ] != null || Grid[ X + 1 ][ Y + 1 ] != undefined ) {
[code]......
I want to create an array which at first stores nothing until data is pulled from a db.This works fine for when there is only a single column index like:
arr1 = new Array();
arr1 = [
["a1"],
[code]......
im getting undefined back for my link value.
pal.onPress = function(){
getURL(links[counter],"_self");
trace(links[counter]);
[code]...
My script below is suppose to make a long text into little portions, Why do i get an error here? The array textMessage is undenifed... [code]......
View 11 Replies