ActionScript 2.0 :: Use A Piece Of Code Only When Condition Is True?
Jan 26, 2011
If i have a piece o code that i would only like to tell Flash to use when a condtion is true how do i do that?Example of my code now:
aa = 1+Math.floor(Math.random()*5);
bb = 1+Math.floor(Math.random()*2);
if (aa == 1 && bb == 1) {
[code]......
View 1 Replies
Similar Posts:
Jun 11, 2004
I know how to do this in other codes, but..if (condition1=true) AND (condition2=true) then... How do you do this in AS?
View 5 Replies
Feb 12, 2011
I need to loop a flv file in flash if a condition is true.
So I tryed to add a listener but id doesn't work.. Code below:
textBox.addEventListener(FocusEvent.FOCUS_IN, focusInListener);
var connection:NetConnection = new NetConnection();
var stream:NetStream;
var video:
Video = new Video(200, 200);
var metaObj:Object = new Object();
[Code]...
View 2 Replies
Nov 24, 2008
I'd simply like to load an mc from my library if my condition is true:
if (condition != false){
insert movieClip here
}
View 1 Replies
Jul 10, 2004
How do I exit a script in case a condition is f.ex. true ? Let's say I have following script:
on (release) {
if (!psw2_fla) {
inf= "Insert password !" ;[code]......
View 7 Replies
Jun 24, 2011
I am using AS2 and I am trying to make a simple 'game' for an assignment for school.I am first trying to make a simplified version of the game, to get some experience before I make the final version.
I will try to explain this simplified version:
The player has to drag an object in a big square and then release it. The object resamples 20 liter water. In total the player has to drag 100 liter water to the square, so it has to drag and drop the 'water' object 5 times.
I want some text in screen that says: You still need .
[Code]...
View 13 Replies
Jan 2, 2011
How to execute a piece of code once a on a frame For Example I want to execute this code only once..
/**********************
var rand:Number = (Math.random())%70;
gotoAndPlay(rand);
/**********************
View 2 Replies
May 3, 2010
How to i create a timer that executes the following peice of code after 10 seconds:
Code:
_visible = false;
View 3 Replies
Oct 6, 2009
I tried something interesting recently. I had code effecting an object with the instance name : object_mc.Now I added another object and gave it the same instance name.The result was, that the code only effected the most recent added object (no error).Is there a way in flash to have multiple objects with the same instance name all being affected by one piece of code?
View 5 Replies
Dec 28, 2010
Whe I use the code below in a template set up as a movie clip it appears and works fine but when i nvagate away from it the relative alignment code remains for the rest of the pages. Would use a remove child how would this look?
[Code]..
View 5 Replies
Oct 26, 2011
Just I want to write a condition in a Function stating If condition. The following is the situation.
If myButtons_mc.alpha=0 then
myButtons_mc.alpha=1
Else myButtons_mc.alpha=0
View 6 Replies
May 18, 2010
package {
import flash.display.Sprite;
import flash.events.*;
import flash.net.FileReference;
import flash.net.FileReferenceList;
public class FileReferenceListExample extends Sprite {
[Code] .....
Code like the above will get executed as soon as loaded, how can I make it run under certain condition? Pretty much this in this answer:
function keyEvent(code:String):void {
// do something with the "code" parameter,
that looks like "alt+ctrl+D", may use .split('+'), etc
}
View 1 Replies
Feb 7, 2002
i am still having problems with the quiz i am doing. You sent me the code:-
if (check1 == true && pa1 == answer){
"well done you has chosen the right answer";
} else {[code]......
I think there is possibly something wrong with my checkboxes, as this is the only part (check1 == true) which isn't working at all in the code.The checkboxes and the buttons are all within the movie clip, have also tried them outside it aswell.
View 8 Replies
Sep 4, 2009
about.buttonMode = true;
about.useHandCursor = true;
I have this on a MC I use for a button - and it works but only on HALF of the object - how can I make so it works on the whole object itself?
View 1 Replies
Sep 12, 2009
I have a BD return by PHP without problem : I have "all_good" and "no_good" If the variable change my condition don't change ..... why
[Code]....
View 3 Replies
Nov 18, 2003
I am pulling the words "true" and "false" from a query, but in flash I need them to be the values of true and false, not strings, is there a way to convert this datatype?
View 3 Replies
Aug 28, 2010
Selectedcolor, true to the text true or false is false text into print.colorPicker component in, I select Export to a selected color, the color value myMC texte into summer, but accuracy can not control.
var myColorPicker:ColorPicker = new ColorPicker();myColorPicker.editable = false;myColorPicker.visible = false;myMC.visible= false;myColorPicker.addEventListener(MouseEvent.CLICK, clickHandler);myColorPicker.addEventListener(ColorPickerEvent.CHANGE, changeHandler);[code].........
View 1 Replies
Jan 31, 2009
I'm looking to find and replace a piece of a url. I researched the site and found this piece of code
ActionScript Code:
String.prototype.replace = function(find, replace) {
return this.split(find).join(replace);
};
[Code]....
However, at run time it doesn't replace the "dev" with "www". It traces the function ok...
View 1 Replies
Oct 2, 2007
I have to make a a hyperlink from selected area over an external loaded swfI load the swf inside of scrollpane, but how can I let the user to create this area as big as he wants and how can I get its position after?
View 2 Replies
Feb 22, 2009
how do you extract something from a piece of string lets say my string is something like mc_empty3 or mc_empty11...how can i get a piece of script to remove piece of it?
View 1 Replies
Dec 16, 2005
I have never done an expandable flash banner before and I am so stumped. An example of what I mean is here (top bwm ad): [URL] The main problem I am having is how do I get that expandable piece to show through like that? If someone could point me in the right direction
View 14 Replies
Mar 24, 2010
I know how to make a basic jigsaw but at the moment i'm trying to create a map of europe jigsaw. Unfortunately with the map taking up the majority of the room there's no space to have all the pieces on screen at once. I had a look for solutions and i found this... [URL] How would i go about making it so that only 1 piece appears on screen until you have placed it?
View 1 Replies
May 23, 2011
I have a XML document that I have to hard-code into AS (Yes, I HAVE to). I am trying to assign this xml to a string but for some reason on the xml doc declaration is assigned?[code]...
When I trace out the xmlDoc string I always only get "<?xml version="1.0" encoding="UTF-8"?>"
I have tried putting the whole document in one string surrounded by 's and concatinating the string like above. Why is the string var only getting assigned to the first line?[code]...
View 2 Replies
Aug 13, 2011
Over the course of four nights in April and May of 1941, Belfast was attacked by the German Luftwaffe bombers. Their aim was to destroy strategic targets in the city which were aiding the British War Effort.What I want is for users to be able to select the word 'German Luftwaffe' and then they will be brought to another frame with information on that topic.
View 1 Replies
Oct 24, 2004
how to rotate individual jigsaw puzzle pieces using the left and right arrow keys. Can anyone help? Here is the action script that I am using:
on (press) {
startDrag("_root.pic9", true);
this.swapDepths(100);
}
[code]....
View 9 Replies
Sep 15, 2005
this code works but I want to set one piece of mask from the library for each mc in the array...how?[code]
View 1 Replies
Dec 9, 2010
Im attempting to make a create your own art work style piece in flash. Ive designed it out so that you first select one of 3 buttons to select which vase you wish to use as a base. However the next set of buttons relate to the colour of that object, so there are 4 options (blue, red, pink and brown) and the user selects one from clicking the appropriate button.
However im strugling to figure out how i would know which of the first options (which vase) the user has selected in the first place. Is there some kind of time line trick or script that i could use to sort this out???
View 7 Replies
Mar 5, 2005
I'm making a piece of flash used for a website banner, previously i've had very little experience with action scipt as i've made various animations only having to use simple functions such as "stop()" and i've made a never ending scrolling menu also, but now i want to have an event that "onPress" a small animation is played where the mouse clicked the banner. What would be the appropriate script to link the .swf i make to the "onPress" command? or what is the right command in general assuming it is that command
View 5 Replies
Jun 13, 2009
Is there a way to break up an image and spread each piece over a grid. each pice will have to be independent so it can move freely,
Is there a different answer from attaching all of the movieclips with different parts inside over a mask,
View 3 Replies
May 2, 2011
ending a piece only when all the buttons are clicked.
Code:
stop ();
nature.addEventListener(MouseEvent.CLICK, buttonClick);
function buttonClick(event:MouseEvent):void{
gotoAndPlay("label 1");
}
[code]....
View 2 Replies