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


Similar Posts:


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 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

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

Xml :: Flex: Display Color Coded XML?

Jan 21, 2010

Is there a component anyone knows of that will take XML and display it has a color coded string so you can read it easily? My app runs mostly from the dynamic XML that is loads. It would be great for debugging if I could click a button in the app to show me the XML it loaded in a readable format.

View 1 Replies

ActionScript 2.0 :: Coded Button States Mx?

Jan 26, 2004

I am trying to complete my navigation bar. I have the onRollOver / Out and Release states finished, my only problem now is that onRelease is not reversable. Once I click on another button, my previously pressed button is still in its down state. All my buttons have been created dynamically with no timelines involved. He is the button code that is within a for loop:

[code]
navBar["myBtn"+i].onRollOver = function() {
//create pointer mc over button

[code].....

View 3 Replies

ActionScript 3.0 :: Hard-coded Playlist XML Url Into Flashvar?

Nov 19, 2008

So right now, I have a video player that pulls in all sorts of info (flv url, caption file url, video title, description, preview image, etc.) through an external xml file (playlist.xml). It works great, but I need to change the coding so it's not hard-coded into the FLA, rather from the embed code for the swf.

Here's the chunk of AS3 code that's involved in the original loading of the XML data as well as the html text too.

View 1 Replies

ActionScript 1/2 :: Passing MC Not As Good As Hard Coded

May 6, 2009

I've got a transition after clicking on a moie clip that goes like this:[code]The mcName variable is a Movieclip delared in the first frame, and set with the name of a movieClip in the onRelease of a button instance:[code]It does take the variable into the FadeFrame function, but doesn't work.It comes out in trace as undefined with the _alpha property.If I hard code the movieClip name into the setInteval it has no problem.Any reason why it doesn't want to operate on the movieClip alpha this way?

View 3 Replies

Actionscript 3 :: Coded SWF Properties In Flash Builder 4

Aug 19, 2010

i want to add a SWF metadata tag to an ActionScript Project in Flash Builder 4, that denotes the default size and background color of the swf. i can do this in Flash Professional, but it doesn't work with ActionScript projects in FB4? can i not include this tag? i know i can set these properties in the properties panel, but i'd like to have them in my code.

View 1 Replies

ActionScript 2.0 :: Depth With Manually Added Mc And Coded Mc?

Aug 18, 2011

I have a depth issue with two movie clips. One of the movie clips I am creating is created with the createEmptyMovieClip function. the other I've embedded onto the 1st frame manually.The one I have embedded manually will not show on top of the one I've created in code. I've tried giving minus values to the one created in code and the manual one still

View 2 Replies

ActionScript 3.0 :: How To Stop Coded Movie Clips

Mar 28, 2012

I have this game where there are moving targets(I move them by code) and you need to click them and every time you click them you get 5 points and they disappear I also made a 30 second timer to and when it hits zero it goes to a frame 7 (Game Over frame).[code]

View 4 Replies

CS3 Embedding Fonts Doesn't Work On Non-coded TextFields?

Apr 19, 2010

I've got a couple of TextField initialized in code (as3). They use my embedded font (aharoni), and that just works. But the fonts that i've written directly into the movieclips in flash cs3, just don't work.

When i play the swf on another computer that doesn't have aharoni, the coded TextFields are aharoni, but the textFields in the movieclips that i've written directly are Times new Roman, because that computer doesn't have Aharoni.
I've set the text font to my embedded font.

View 5 Replies

ActionScript 3.0 :: List Component That Has Hard-coded Labels On It

Sep 23, 2010

I have a list component that has hard-coded labels on it (for testing). I then rotate the list component 90-degrees and notice the text disappears(during design time).

I test the file and the labels do not show up also during runtime.

I can get the labels to show if I rotate the component back to its' original state.

View 1 Replies

ActionScript 2.0 :: Coded Draggable Rotating Movieclip Effect?

Mar 18, 2010

My client has a simple shape that they want the user to be able to animate, i.e. it looks like a single square on the stage, but when you grab it and drag, a load of squares appear and fan out from the corner of the first. I was thinking, I can easily achieve the first part of this by attaching, say 20 movieclips of my square to the stage, but I'm not sure how to approach the back/forth draggable aspect of this.

View 1 Replies

ActionScript 3.0 :: FlashCS5 - Embedded Font With Coded TextField

Jun 20, 2010

I have a website project to finish on monday and I'm with a huge problem. I need to create textFields from AS3, load it's text from xml and use loaded CSS file in it. I've embedded the font but it doen't work, and worst, not working even with Times or Verdana fonts. I have embedded the fonts using default name, "Font 1", etc, since I read those export names must be different then system font name. Here are the code (bad one, only to show the problem), the CSS, and the capture of the swf is here:

[Code]...

View 0 Replies

ActionScript 3.0 :: Dropdown Menu - Coded Animation With Child Sprite

Mar 18, 2010

I was trying to code a rollover rollout dropdown menu in code. I made a movieclip in the library which imports a rectangle sprite. The rectangle sprite moves down on frame2 and back up on frame3. When I called the frame from document level it gives me following error:

[Code]...

View 5 Replies

ActionScript 2.0 :: Loading / Calling .swf (relative / Static / Hard-coded Paths)

May 7, 2004

if someone can shed some light to this matter... i'm pretty new (somewhat) w/ AS let's say, i got an .swf (voets enahnced mp3-player) @ [URL] --which works perfectly at the moment. i then referrenced this .swf in [URL] --which doesn't work prolly because the .swf is calling the XML (i.e. "onlineplaylist.xml") relative to its whereabout, which is /test08. the question is, is there any way around this problem, so that if i put all .SWFs in a certain location (server/directory/what-have-you...), and referrence it from another server &/or directory (like above), it would work?

[Code]...

View 2 Replies

Flash :: Platform - Create A Colorful Display And Link It To Hard Coded Some Pages?

May 7, 2011

what is the easy to learn platform platform to create a colorful display and link it to hard coded some pages

View 1 Replies

ActionScript 3.0 :: Difference Between Hard Coded String And Textbox String?

Apr 7, 2011

Im playing around with the last.fm api... Specifically the "getLovedtracks" call.... [URL] This is a weird one that I have never come across... The above call requires a username to return a track listing so if I hard code the username into my class like this.... var username:string = "aidanmack" No problems the call works... if I make that username equal to a dynamic text box string that has "aidanamck" typed into it..
so something like... var username:string = mystage.textbox.text

the last.fm api wont except this... I get user does not exist But if I check the call with the charles proxy Flash is defo sending the username "aidanmack" So I wonder if its to do with have how last.fms api interprets the string?

View 2 Replies

ActionScript 2.0 :: Saving "coded" Shapes?

May 28, 2003

I am wondering how is it possible to Save or Export a drawing which is done by code produced wihthin the swf??For example we have some lines where the user could draw on a board and after finishing his artwork he could export it as a bitmap or even better as an eps or swf

View 12 Replies

IDE :: Use If And Else Statements And Failing?

Apr 15, 2009

I am trying to use if and else statements and failing. I am either completely missing their purpose, or just not writing the correct code. Scenario: I have designed a gallery that consists of animation in movie clips that are placed on the time line. With the if/else statements I need Flash to know what movie clip the user is on, so that the users next action loads the correct movie clip.

[Code]...

View 4 Replies

Double Up If Else Statements?

Apr 18, 2009

Is it possible to double up If Else statements? [code]...

View 2 Replies

AS2 :: If Statements On Buttons

Sep 14, 2009

how do i create an if statement for some buttons to say something like:

-if button1 is pressed go to frame1
-if button2 is pressed go to frame2 etc.

i know i could use button1.onRelease = function(){blah blah;} but i would like to start using if statements and this is a good place to start i guess

View 1 Replies

ActionScript 1/2 :: Join Two If Statements Together?

Dec 3, 2006

I want to join two if statements together and I'm unsure of the syntax. This is what I have but it is obviously wrong. if (Key.isDown(Key.RIGHT) or if (moveRight_btn.onPress){

View 7 Replies

ActionScript 3.0 :: Cannot Get If Statements To Work

Oct 6, 2009

How to do a rollover button where you rollout and it doesn't another option depending on the current frame. So I decided to open up another actionscript file and do a test so that I knew that I could make an if statement work in a barebone state. And I can't get it to work

First I stated my variable to be 0. I added 3 buttons. Button One makes the variable unit "myVar" to 1 and Button Two makes it 2. And my output button reacts to these variable changes. But it doesn't work.

ActionScript Code:
One_btn.addEventListener(MouseEvent.CLICK, OneV);
Two_btn.addEventListener(MouseEvent.CLICK, TwoV);
Output_btn.addEventListener(MouseEvent.CLICK, OutputV);
var myVar:Number = 0;
function OneV (event:MouseEvent):void {
[Code] .....

View 4 Replies

ActionScript 2.0 :: Cannot Retrieve Statements Value

Nov 20, 2009

well after I made all of the conditional statements I came to the conclussion and the annoyance that I cannot retrieve the statements value, I need help:[code]it does not return the value.. why?

View 5 Replies

ActionScript 2.0 :: Functions With If Statements?

Mar 3, 2011

I was wondering if anyone would be able to shorten this.All of my attemts at it have resulted in errors/not working.

ActionScript Code:
enemy1.onEnterFrame = function() {
if (this.hitTest(p1)) {

[code].....

View 1 Replies

ActionScript 3.0 :: How To Apply The Get / Set Statements

Aug 25, 2009

After searching for how to do this i discovered the Get/Set functions of as.3. The only problem is that i am not experienced enough with this kind of statement to get it working, so i have come here to seek from the wise and masterful members Here is some more info:Inside a fla called "Main" i have 2 MovieClips. The first is called Main and has a class linking to the com/Main.as file which has this code:

Code:
package com{
import flash.display.MovieClip

[code]....

View 10 Replies

ActionScript 3.0 :: Using Variables And If Else Statements?

Apr 19, 2010

used to be able to handle variables and if else statements back in AS2.0, but I don't know how to go around them in AS3.0For instance, a code like this:

stop();
var pageNum = 1;
var pageAnim = 1;

[code]....

View 7 Replies







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