Actionscript 3 :: Difference Between Conditionals?
Nov 9, 2010
Just wanted to know if someone can explain the difference between these two conditionals:
if ( !object )
if ( object == null )
where object is an instance of a user-defined class.I'm sure that these two cannot be used in an interchangeable manner, or are they?
View 3 Replies
Similar Posts:
Jun 11, 2009
I've got a function which looks at movieclips (ball#_mc) which have been placed in a target zone (_ballPlaced[#] boolean). It then decides where to go on each movieclip timeline depending on which other balls have been placed in a target zone.Only the first condition is ever met, i.e. when all the balls are in a zone, they jump to their correct places in their timelines....however, it doesn't work for any of the other 'else if' conditions?
Here's my code...
// function to determine which video to play for each ballprivate function playVideo(event:Event):void { if (ball0_mc._ballPlaced[0] && ball1_mc._ballPlaced[1] && ball2_mc._ballPlaced[2] && ball3_mc._ballPlaced[3]) { ball0_mc.gotoAndPlay("BluYelRedGre");
[code]....
View 2 Replies
Apr 30, 2010
Is there a better way to do use a use a boolean with visible? I'm setting up animations that have conditions for visibility, and I don't want to use something that performs poorly. This animation blinks 30 times and stops. It works without error, but takes a moment to load. I would like to learn other ways of using visibility with conditionals.
This is what I used 'waits before playing'
if(condition=5){
box.visible = !box.visible;
This works fine 'no pause'
if(condition<6){
box.visible = !box.visible;
[Code] .....
View 1 Replies
Jun 30, 2009
I've got a function which uses a 'hitTestObject' test if two moive clips are touching each other. A FOR loop has been used to run through all the zones, to check if they've been touched. Within this FOR loop is an IF condition which then locks the ball to that particular zone if the ball and zone are touching. The ELSE statement sends the ball back to a random place on the stage if they're not touching.
However, the IF statement seems to be getting bypassed. Whenever a ball is dragged over a zone and the mouse is released, rather than locking to that zone's x and y positions, it gets placed randomly on the stage...i.e. the ELSE statement is being activated all the time?! I've commented out the ELSE condition and the IF works fine on it's own, it's just when the ELSE condition is included the IF is bypassed.
ActionScript Code:
private function zoneFill(event:MouseEvent):void{
for (var i:uint = 0; i<=8; i++){
var index:Number = event.target.name.substring(5,6);
if(event.target.hitTestObject(zone[i]) && zoneFull[i] == false && event.target._ballPlaced[index]== false){
[Code] .....
View 1 Replies
Aug 28, 2009
I have an xml file that currently contains the following parameters:
<navigation>
<node title="Portfolio 1">
<picture>
<thumb></thumb>
<img></img>
[code]...
View 2 Replies
Nov 23, 2009
I need to load a movie only if it's a specific calendar date.
i.e. if date = (date) loadmovie
View 14 Replies
Feb 8, 2010
I'm working with CS4 and AS3 using timeline coding. I have three sets of movie clips in three different arrays. The idea is to have topArray and downArray movies make zeroArray movies visible. For instance, if topArray[0] and downArray[0] are clicked, then r0_0 becomes visible. PROBLEM: r0_0 becomes visible when EITHER topArray or downArray is clicked. How to make r0_0 wait until BOTH top and downArray movies are clicked?
[Code]...
View 5 Replies
Feb 9, 2010
I'm working with CS4 and AS3 using timeline coding. I have three sets of movie clips in three different arrays. The idea is to have topArray and downArray movies make zeroArray movies visible. For instance, if topArray[0] and downArray[0] are clicked, then r0_0 becomes visible. PROBLEM: r0_0 becomes visible when EITHER topArray or downArray is clicked. How to make r0_0 wait until BOTH top and downArray movies are clicked?
ActionScript Code:
//
//movie clips holdings results -- all invisible
var zeroRow:Array =[r0_0, r0_1, r0_2, r0_3, r0_4, r0_5, r0_6, r0_7, r0_8, r0_9, r0_10];
for (var a:int=0; a<zeroRow.length; a++) {zeroRow[a].visible=false}
[code]....
View 4 Replies
Nov 16, 2010
I have the following: ActionScript Code: if ((player.charVelocity < 9.0180945396304027e-26 && player.charVelocity > -9.0180945396304027e-26)) it seems to be firing as soon as charVelocity gets between 1 and -1. Am I writing that correctly? I assume it would work as I copied the syntax it was outputting for the variable value (which is set to 'int')
View 5 Replies
Nov 29, 2011
I want to calculate the angle a line makes with the positive x-axis in a clockwise direction. It's a lot like a bearing except instead of North, I want the angle it makes with positive x-axis. The image illustrates what I'm after.
Below is the code I wrote to achieve this. It works fine but I am just wondering if there's a way to reduce all these if statements.
ActionScript Code:
/**
* @return Bearing, in radians, of <code>p2</code> from <code>p1</code>
*/
[Code]....
View 2 Replies
Jan 25, 2010
var btn:Button;
if(btn != null && btn.label != '') {
mx.controls.Alert.show("d");
}
In the above if clause, is it guaranteed that the first condition(btn != null) will be evaluated before the second condition?
View 2 Replies
Nov 11, 2011
i'm working on a homework assignment in where we created a match game. It's up to me to figure out how to tell the action script which difficulty the user play the game at. There are 3 buttons easy, mediym, hard. Each one lays out an increased number of cards say 4 for easy 8 for medium etc.
we are supposed to use the switch conditional to do this.My problem is how does the switch know which button was clicked?here is the code so far, it is only set up for the easy at the moment.It works fine until I tried to set up the switch.
package {
import flash.display.MovieClip;
import flash.display.Sprite;[code]....
when I click the easy button in the swf file I get this message.
ReferenceError: Error #1069: Property level not found on flash.display.SimpleButton and there is no default value.
at Match/onClickButton()
View 3 Replies
Mar 5, 2012
I have checked over and over again. But when I run it, it always skips the first two currentFrame if conditionals and runs the last currentFrame if conditional. I have this code in another file and it works perfectly...
[Code]....
View 2 Replies
Aug 6, 2009
If I use an Assignment within conditional, for e.g.
if(userType='admin')
Flex throws a warning,unlike Java, which throws an error.Why should Flex be doing this, despite being one of the newest languages? 1100: Assignment within conditional. Did you mean == instead of =?
View 2 Replies
Dec 20, 2010
what are the differences between '.this' and '.stage'?
View 4 Replies
May 24, 2011
What are the main differences between the versions?
View 3 Replies
Aug 25, 2010
i am intermediate programmer.but i think that has ended 2 days before when i came across a simple while loop.which i can't figure it out how the stuff works..[code]from 1 - 9 ,that is (1,2,3,4,5,6,7,9);I want to know difference between pre and post additions in the loops.if the first program adds the increment value after each loop , then why didn't it prints the (0) value. and i also want to know that ,Why this methods does not have any difference on for loops....
View 9 Replies
Aug 9, 2004
What's the difference between if, while and do..while besides the way they are presented?
[Code]...
View 10 Replies
Jun 21, 2009
Both are working, can be used, but I'd like to ask what's the difference between '}' and '};'. Let me know if I asked something very stupid.
View 4 Replies
Feb 26, 2002
But what is the difference between [] and (). I used () in the random letters tutorial and it didn't work. When i used [] it worked.
View 2 Replies
Dec 28, 2010
what's the difference between for example:
var H:int;
var _H:int;
View 6 Replies
Feb 25, 2005
I am trying to load random external SWF's using XML. I'm not having any problems loading JPG files, but the SWF's just won't load. Is there a difference between JPG's and SWF's when loading using loadMovie? Pointers to tutorials or pages in the manual would be great.
Here's a snippet of the code:
[AS]
function firstImage() {
if (p<(total-1)) {
p=random(total);
[Code]....
View 1 Replies
Mar 16, 2009
I was looking for the difference between the different content types in Flash CS3/CS4 - Browser/Screen Saver/Application etc - especially it's capabilities and limitations. Of interest are Standalone player and Application.
View 3 Replies
May 4, 2009
Each line in the dynamic textbox has 15 characters, and yet you can notice the difference in the length(between each line).
I want to make the length of each line look same if they have same number of charaters.
View 6 Replies
May 13, 2009
Suppose I'm building a game where your ship moves with left/right keys.I assign a speed variable which is the number of pixels the ship will move when you press one of the said keys.Currently (on the tutorial I'm following) I have:
Quote:
static const speed:Number = 150.0
Can't I just replace it:
Quote: var speed:int = 150
Also, what's the difference between var a:Number and var a:int? And is there any important reason to add the .0 in 150.0?
View 2 Replies
Aug 5, 2009
I was just wondering what the difference between these two is.
View 1 Replies
Aug 1, 2009
What is the Difference between macromedia flash and flash cs4. What is the Advantage of Flash cs4. Why Flash CS4 came..?
View 4 Replies
Apr 22, 2010
What is the difference between set and get functionality?
View 1 Replies
Aug 20, 2010
What is the difference between FMS 3 and FMS 3.5? Is 3.5 a totally new version or just some kind of service upgrade?
View 8 Replies
Oct 25, 2011
difference between XML and XMLList in my example code? I am passing a node to the function and extracting the url of the file:
private function getFile(node:XMLList):String {
var file:String;
for(var i:uint=0; i<node.children().length(); i++) {
trace("Test 1: "+node.children()[i].@id);
[Code]....
Why do I have to have 'current' as XML and not as XMLList? I thought XMLList's with length == 1 are handled as XML's anyway, aren't they?
View 7 Replies