ActionScript 3.0 :: Try/catch Statements Working But Not As Expected?

Aug 21, 2009

I've got some try/catch statements in an XML parser I've written that don't seem to be doing what I want them to be doing.

The code:

ActionScript Code:
try
{[code]........

The problems:

-In the case the type is analysis or info (with other tags being alright) the "Default Text" is staying blank, even without a text tag.

-If I purposely malform the option tag, no alert window shows up and none of the other properties in the catch block (optionText,selType, etc.) get set properly

View 3 Replies


Similar Posts:


Actionscript 3 :: OOP Not Producing Expected Result With If Statements And > Signs?

Nov 8, 2011

Below is my code:This code is used to find the surrounding nodes when supplied with a given node. i.e

for(var i:uint = 0;i < nodes.length; i++){
test_node = this.nodes[i];
if (test_node.row < node.row - 1 || tes

[code].....

View 1 Replies

Ionscript 3 :: OOP Not Producing Expected Result With If Statements And > Signs?

Jul 28, 2009

Below is my code:This code is used to find the surrounding nodes when supplied with a given node. i.e

for(var i:uint = 0;i < nodes.length; i++){
test_node = this.nodes[i];
if (test_node.row < node.row - 1 || test_node.row > node.row + 1) continue;

[code]....

View 1 Replies

ActionScript 3.0 :: Mouse Controls Not Working As Expected In IE?

Mar 31, 2010

I am developing a simple galaga clone for my site, its at [URL] . You will notice the controls work fine in firefox, opera, safari, chrome, etc. However, in IE, the controls are only triggered if the mouse cursor is hovering directly over the player ship.

The playership object is created in the main document class which passes a reference to the stage to the playership class.

private var ourShip:playerShip = new playerShip(stage, ourHUD);

Which is then added to the stage from within the document class (gameMain)

stage.addChild(ourShip);

The playership class then monitors the mouseX and reacts accordingly. The code for the ship controls which are linked to the enter_frame eventhandler is

Code:
public function controlShip(e:Event):void {
var a1 = stageRef.mouseY - e.target.y;
var b1 = stageRef.mouseX - e.target.x;
var radians1 = Math.atan2(a1,b1);

[Code]....

View 2 Replies

Flash :: Gallery Template Not Working As Expected?

Jul 6, 2009

I have created a flash gallery using the in built template in Flash8, which works fine. The gallery forms part of my gallery page of a separate SWF flash site. I load the gallery using a loder component. Since the gallery navigation works by targeting the root folder, my site gets screwed up. The question is, how do i modify the ActionScript in the gallery.fla file (flash inbuilt template), so that once loaded into the main site, it doesnt target the root timeline, but targets its own timeline i.e.Please see below for the code in the Flash Gallery. PS: I didnt write the code - its inbuilt into the template:

function updateFrame (inc) { // send slides to new frame newFrame = _level1._currentFrame + inc; _level1.gotoAndStop(newFrame);
updateStatus();

[code]......

View 1 Replies

Flex :: MouseEnabled Where Transparent Not Working As Expected

Feb 28, 2011

I just cannot understand why mouseEnabledWhereTransparent does not work on this skin. The Skin this creates is basically a Button with a transparent background and a little triangle to the left side, like so: >ButtonText But the empty space around the Triangle does not receive mouse events. I've tried wrapping another group around the triangle path and I've tried wrapping it into a Graphic Object, also without success. I could create a Rect with 0 alpha below everything, but isn't that exactly what mouseEnabledWhereTransparent should be doing?

<?xml version="1.0" encoding="utf-8"?>
<s:SparkSkin xmlns:fx="[URL]" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:fb="[URL]" minWidth="21" minHeight="21" alpha.disabled="0.5" mouseEnabledWhereTransparent="true">
<!-- host component -->
<fx:Metadata>
[Code] .....

View 2 Replies

Actionscript 3 :: Using Graphics.clear Not Working As Expected?

Mar 12, 2012

Would anyone know why using graphics.clear(); in this example is preventing the graphics from being drawn?

e.g. the following code works and the lines are drawn.

var my_shape:Shape = new Shape();
my_shape.graphics.lineStyle(2, 0x00FF00, 1);
addChild(my_shape);

[Code]....

I'm wanting to animate the line moving so would like to clear the previous drawing before redrawing the lines.

View 1 Replies

ActionScript 2.0 :: Loop SlideTo Is Not Working As Expected?

Jan 16, 2007

In the following code, I create 12 buttons, label them, and control their onRollOver,onRollOut, and onRelease actions. Everything is working fine except for the line containing the "slideTo" method. Reading from the two arrays for the x and y values, it appears to be inserting the largest number in each array instead of stepping through all 12 values. Currently, clicking on any of the buttons moves the object (ralphMC) to x=100 and y=800. I am pretty stumped about this, as I've inserted quite a few various numbers into each array during testing. Can anyone tell me what I am doing wrong?slideTo is part of the mcTween package, in case anyone wanted to know. code follows:

Code:
//Creates an array of numbers that will evenly space the buttons out vertically
var mcPosY:Array = new Array();

[code].....

View 1 Replies

ActionScript 3.0 :: Flash Buttons Not Working As Expected

Dec 23, 2011

I've followed this tutorial and made a functional photo gallery.

Now, I want to add that photo gallery on my site. I've created a flash button and assigned it this action:

Code:
on (release) {
_root.contents.loadMovie("Pictures.swf");
}

"contents" is the container movie clip, and "Pictures.swf" is photo gallery i've made. Now, when i click on button, Pictures.swf does load (arrows are being shown), but when i click on them, nothing happens.

View 4 Replies

Flash :: BitmapData.draw ClipRect Not Working As Expected?

Jun 29, 2011

I have a component that contains 4 layers: (in ascending depth order) bgImage:Sprite, dropZone:Sprite, dropMask:Sprite and line:Sprite. The bgImage is at 0,0, and the other objects are placed at various positive coordinates. dropMask is masking dropZone.At the point of bitmap capture I want to only draw from the dropZone and dropMask layers, so I'm trying this:

removeChild(bgImage);
removeChild(line);
var bmd:BitmapData = new BitmapData(dropMask.width,dropMask.height,true,0);
bmd.draw(this,null,null,null,dropMask.getBounds(this));

Despite the dropMask being located at 50,60 the capture always starts from 0,0. I've also tried getting the boundary rectangle and forcing the x,y, but it makes no difference. should I just forget clipRect and use a matrix instead?

View 2 Replies

ActionScript 3.0 :: Stage RemoveChild (Target) Not Working As Expected

Nov 7, 2009

I'm new to AS3 and have been making a Snake game. I've come up with a problem with the code (Yes, I have magically created problems trying to program Snake...It's going to be a long day). My problem is, with removeChild...I'm getting strange errors being throw at me. Not only that, but my Movieclip (myFood) is not being removed entirely, only the visuals of it are.

That being said, here is, what I believe to be, the most important chunk of code for this problem, along with the error it gives me.
Code:
/*
* Code for the Snake and whatnot extras.
* Also, Snake and Food are classes.
*/
var myFood:Food = new Food();
stage.addChild(myFood);
function snakeEatFood() {
[Code] .....

View 2 Replies

IDE :: Catch Block Not Working?

Oct 29, 2010

why my code not workinghere is my as code

package com_dp
{
import flash.net.URLLoader;

[code].....

View 1 Replies

ActionScript 3.0 :: IOErrorEvent Try Catch Statement Not Working

Sep 24, 2009

I have a picture loader to load pictures on a website I am making and I want it to check for a picture and if the picture is not at the url, I want it to run a function and not throw an error. I tried using try catch but it didn't work so I tried using an IOEventListener and that still didn't work.

View 2 Replies

ActionScript 3.0 :: Trace Statements Not Working?

May 30, 2011

if trying to debug in Flash, and for some reason some of my trace statements don't work. I believe this only happens when they're in event listeners, but it is very annoying. I am using CS5 and coding in Flash Builder 4.

View 4 Replies

ActionScript 3.0 :: Multiple If / Else Statements - Not Working

Dec 31, 2010

I've been developing an AS3 based 2D fighting game engine (like Street Fighter II), and have run into an issue. I'm using if/else statements in my onEnterFrame function to hit test my fighters. This works great in my first if/else statement, but for some reason it doesn't recognize my second if/else statement that follows the first. I know it's not the code, because if I bring the second if/else statement up and place it above the first statement (simply swapping the order), the hit test is successful. Why is it that only the if/else statement that comes first works, but any that come after it don't?

Here's my code:
function onEnterFrame(event:Event):void {
//MOVE THE char1
PlayerBase.players[0].x += plyr1vx;
PlayerBase.players[1].x += plyr2vx;
[Code] .....

I've also attached a .zip file with my published files so you can see the issue in the game (must be viewed in a browser for keys to work correctly). Move the left player using "A" and "D" keys. Make him punch with "Z" and kick with "X". Punch is the first if statement in my code, and kick is the second if statement (not working).

View 10 Replies

ActionScript 2.0 :: If Statements Not Working As Coded?

Aug 20, 2004

I'm constructing a game for college and I've run into a problem. I've created a drag and drop game,I have 9 instances called "case_01", "case_02" etc. The user must place them into one of two boxes (called "input_01" and "process_01"). I've then created an incorrect message on frame 3 and a correct mesage on frame 5. I've placed the following code on the submit button with the correct answers:

[code]...

but this isn't working correctly. Must each if have an else? I'm a complete novice at this actionscripting

View 6 Replies

Flash :: Put Single Try Catch Code, In Order To Catch Any Errors In Whole Class?

Aug 11, 2010

In Flash AS3 i wanna write the single try catch block in order to catch any errors in whole class. For ex, i have a lot of functions in myClass.as. I don'w wanna write in each function try catch blocks in order to catch errors in this function. Is there any methods to do this?

View 2 Replies

Flash - AsyncErrorEvent Isn't Working To Catch Errors For RTMP Video Player

Nov 19, 2009

I have this streaming video player with an asyncErrorHandler function which isn't working correctly.In Flash player 10 I get no errors, but in Flash player 9 I'll get a popup window with the error message that shows up in my output window when I test on my local machine.

Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.NetConnection was unable to invoke callback onBWDone. error=ReferenceError: Error #1069: Property onBWDone not found on src.display.VideoClass and there is no default value.

I feel that I have my AsyncErrorEvent setup correctly however, but am unsure as to why I still get a massive error in my output window, here is the popup window and code below:My statusEventHandler function

// ☼ --- Handle Status and Errors
function statusEventHandler(event:NetStatusEvent):void {
trace("connected is: "+ncConnection.connected);
trace("event.info.level: "+event.info.level);

[code]...

View 1 Replies

ActionScript 2.0 :: If Statements Within If Statements?

Oct 7, 2004

If they get a question wrong in my quiz ( weakest link) the money clip goes to zero and it goes onto the next question. If they get it right the money clip advances and they go onto the next question. I want to include each time that it should only go onto the next question if all questions have been asked. SO i want an extra if clause in both sections, saying if current question is more than 11 go to '#game over"The questions are saved in the frame of the quiz

_root.qArray = new Array("question: A;B;C;D")
_root.qArray.push("Question?:A;B; C; D")

There are 11 questions.At the moment at the section with choosing answers I have

function selectAnswer(n) {
// correct
if (answers[n] == correctAnswer) {
_root.money.nextFrame();

[code].....

View 1 Replies

ActionScript 2.0 :: Expected A Field Name After '.' Operator

Mar 13, 2010

I have 5 buttons in one movieclip "star_mc"

* star_mc.sub1
* star_mc.sub2
* star_mc.sub3

[Code].....

How can i fix this error "Expected a field name after '.' operator" ?

View 2 Replies

ActionScript 2.0 :: Expected A Field Name After '.' Operator?

Aug 17, 2011

I have 5 buttons in one movieclip "star_mc"

* star_mc.sub1
* star_mc.sub2
* star_mc.sub3

[code].....

View 2 Replies

ActionScript 3.0 :: Incorrect Number Of Arguments - Expected No More Than 0?

Feb 17, 2009

I'm trying to make a simple slideshow that ends with the option to click and enlarge each image. Clearly, I'm a complete n00b at this and know nothing about coding.

Here's what I've done:Created the slideshow. It works. Created a thumbnail of each picture and made it into a button (btn1, btn2, btn3, btn4) with the same instance names, each on their own layer. Created an Actions layer with the following code:

stop();
function rollOverFunction(evt:MouseEvent) {
play();

[code]....

The code was working fine until I added the second button...now I get the error above.

View 6 Replies

ActionScript 2.0 :: Array/loop Not Functioning As Expected

Oct 8, 2009

I have a series of MC's (ultimately about 55) which I'm performing some actions on when a user hovers over the MC.

Code:
var items:Array = [
UnitedStates,
Brazil,

[Code].....

All my variables and paths test correctly; but, when I test the swf, if I hover over _level0.item_0, _level0.item_2 is the MC that received the actions. As I add more MC's, it's always the last MC that receives the behavior. To clarify though, the _visibility and _alpha values do set themselves for all of the MC's. It's just when a user hovers over _0 and _1 that nothing happens to the clip being hovered and _2 receives the order to execute the tween.

View 5 Replies

ActionScript 3.0 :: Incorrect Number Of Arguments Expected 1?

Feb 2, 2012

i want to set busycursor in loadValue Function. But i'm getting error as Here i'm getting an error as incorrect number of arguments expected 1.the error that i'm getting in 3rd line. and i have not pasted full code here. But i pasted only where i'm getting error when i tried to inser busyCursor.
 
[code]...

View 3 Replies

ActionScript 3.0 :: Incorrect Number Of Arguments - Expected No More Than One

Nov 8, 2010

Below is my script from Flash CS5(AS3), there is an error on line 8 reading: 'Incorrect number of arguments. Expected no more than one.' and I cant for the life of me understand what's wrong. Obviously I understand the error, but I am running myself rugged trying to fix it!

[Code]....

View 3 Replies

ActionScript 3.0 :: Argument Count Mismatch - Expected 0 / Got 1

May 7, 2009

ArgumentError: Error #1063: Argument count mismatch on Cars_fla::MainTimeline/addCar(). Expected 0, got 1. I understand that it expects 0. But I don't understand from where it get's 1 parameter..?

Main timeline code
import Car;
import flash.display.MovieClip;
import flash.events.MouseEvent;
add_btn.addEventListener(MouseEvent.CLICK, addCar);
function addCar() {
[Code] .....

View 3 Replies

ActionScript 3.0 :: Expected Definition Keyword After Attribute Function

Apr 23, 2009

I have been building my website using a simple mouse event click system that makes movie clips play at specifically names keyframes. it took me a bit, but I got it right and the code was simple. here is an example of the code that works:
films.addEventListener(MouseEvent.ROLL_OVER, btnOver1);
function btnOver1(event:MouseEvent):void{
sketch_5.gotoAndPlay("f_over");
}

Pretty simple stuff. but now I am working on a paid project for someone, and it is a bit more complicated in scope, but essentially I would be using the same code over and over again. it's a glorified slide show. but I ran into a problem. I used this code, which is the same (with different names and mouse event) as the one above.
mcLifeLED.addEventListener(MouseEvent.CLICK, Light_Type);
Function Light_Type(event.MouseEvent):void{
mlights.gotoAndPlay("p_life");
}

Its telling me that "Function Light_Type(event.MouseEvent):void" is wrong with this message "1071: Syntax error: expected a definition keyword (such as function) after attribute Function, not Light_Type." I may be wrong, but from what I can read in it, it's telling me that the function I named about "Light_Type" can't be found...

View 2 Replies

ActionScript 3.0 :: 1137: Incorrect Number Of Arguments Expected No More Than 0?

Jul 18, 2011

i have a small problem with the APEngine class.Everytime I try to run it, it gives me this errorPHP Code:1137: Incorrect number of arguments.  Expected no more than 0. the line it refers is this one:PHP Code:force = new Vector(0,0); Whats going on?? I mean, I don't understand how it can be wrong, as the APEngine class imports a custom Vector class, but Flash thinks I'm using the original Adobe Vector class

View 2 Replies

ActionScript 3.0 :: 1136: Incorrect Number Of Arguments. Expected 1?

Jul 29, 2009

When i test the game I am making I get this error:  1136:Incorrect number of arguments. Expected 1.
 
My question is how do I get the showSponsors(); (in bold) to call the private function showSponsors.
 
[Code]...

View 6 Replies

Error 1137: Incorrection Number Of Arguments. Expected No More Than 1

Aug 4, 2009

I want my navigation bar to open other pages in the same window.  Currently, it's opening as if it's _blank (must be the defaut when nothing is coded).I thought I was coding correctly, but the error above popped up - so now I don't know what to do next.The code as it is with the error is as follows - the line with the error is highlighted in italics.
 
function goHome(event:MouseEvent):void { var targetURL:URLRequest = new URLRequest("http://www.fairwoodcommunitynews.com/Alphatest/Home.html", "_parent"); navigateToURL (targetURL); }
homeBtn.addEventListener(MouseEvent.CLICK, goHome);

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved