Boolean(this.win)
why this works on flash 6 but not in 8 ??
any idea .. plz help
Code:
this.wins= Boolean(this.win);
if(this.win){
trace("WINNER")
}else{
trace("LOOSER")
}
ActionScript.org Forums > Flash General Questions > Flash 8 General Questions
Posted on: 04-21-2006, 03:44 PM
View Complete Forum Thread with Replies
Sponsored Links:
Boolean LED
Hello,
I am trying to find a LED or a small light that is lit up with a variable is true and is not lit when the variable is false. I would like the light to react as soon as the variable changes.
Does anyone know if such a light exists or am I going to have to make one myself? This is essentially a boolean indicator. Are there any other forms of indicators that may be available if the light or LED is not available without having to use text?
Thanks for your help in advance!
-Nathan
View Replies !
View Related
Boolean Help
I had posted earlier about a question and am still having problems on how to solve it.
My original post:
I have two movie clips on my main timeline. Inside each movie clip are the frame labels, "foreground" and "background". On the foreground state, an image moves to the foreground of the viewable area by use of a motion tween. On the background state, the image moves back to the background of the viewable area. This is set up similar to an advanced rollover.
From the main timeline, I can click on each mc to make it move back and forth. My next step is to create a variable and an if, then statement to check and see if one of the mc's has moved to the foreground state. If it has, then it needs to move back to the background to allow the other mc to take it's place.
I'm pretty sure this is possible, but I'm not quite sure how to go about it. When I create the variable, should it have a string or should it be a boolean? Do I need more than one variable? Within my if, then statement can I target a frame label inside a movie clip from the main timeline?
So, when I click on mc2, check to see if mc1 is on the "foreground" state. If it is, then move mc1 back to the "background" state, and move mc2 up to the "foreground" state.
Eventually, this will become about 6 or 7 mcs that will need to check and see if any are in the foreground, and if so, to move them back so that the selected mc can move up and swapp out the current mc. Make any sense?
After receiving a suggestion to use a Boolean variable, I placed in the following code:
girl2_mc.onRelease = function() {
if ( girl1_mc._currentframe == 21 ) {
girl1_mc.gotoAndPlay("background");
this.gotoAndPlay("foreground");
}
};
But, I'm still not getting it to work. Here is a link to my fla:
http://www.daveharperdesign.com/uploads/concept1.2.fla
thanks for any help that can be offered.
Dave
View Replies !
View Related
Help With Boolean Value
I need some help with this. I don't understand why mu code doesn't work.
I am making a mute button that that switches when a use presses the button. my MC's name is muteButton_mc, and the various states are named, off_mc, on_mc, and over_mc. can someone help me please !!!!
here is the site I am making for my upcomming company http://equinoxdesigninc.com/eqd/eqd.html. Here is the code I have written in an actions frame:
// declares a Boolean values
var num:Boolean = new Boolean();
var myBoolean:Boolean = new Boolean();
var vis:Boolean = new Boolean();
// makes the on muteButton visible to start with
this.muteButton_mc.off_mc._visible = false;
this.muteButton_mc.over_mc._visible = false;
this.muteButton_mc.on_mc._visible = true;
// makes equalizer visible in the beginning
equalizer_mc._visible = true;
// swaps out buttons
function swap(num) {
if (num == true) {
return false;
} else {
return true;
}
}
// tests to see if the on_mc is visible
function test() {
if (muteButton_mc.on_mc._visible=true) {
return true;
} else {
return false;
}
}
// on enter frame function
onEnterFrame = function () {
muteButton_mc.onRollOver = function() {
muteButton_mc.over_mc._visible = true;
}
muteButton_mc.onRollOut = function() {
muteButton_mc.over_mc._visible = false;
}
muteButton_mc.onPress = function() {
muteButton_mc.over_mc._visible = false;
var vis=test();
var myBoolean=swap(vis);
if (myBoolean==true) {
muteButton_mc.off_mc._visible = false;
muteButton_mc.on_mc._visible = true;
equalizer_mc._visible = true;
}
if (myBoolean==false) {
muteButton_mc.off_mc._visible = true;
muteButton_mc.on_mc._visible = false;
equalizer_mc._visible = false;
}
}
}
All help would be appreciated!
View Replies !
View Related
Boolean
Hi, My name is Damien. I need some help with the boolean code. How do you test if an object is being dragged while using the Boolean and maybe another function similar to hitTest()?
View Replies !
View Related
Boolean Value
Hi ,
I have a action script written for start stop timer.I need to return
true if the timer starts or ends.I use Flex builder 2. My code is as
follows:
package time
{
import flash.utils.Timer;
import flash.events.Event;
import flash.events.TimerEvent;
public class TimerProject
{
private var timer:Timer;
public function startTimer():void
{
// timer = new Timer(1000,2);
timer.start();
}
public function stopTimer():void
{
timer.stop();
}
public function resetTimer():void
{
timer.reset();
}
}
}
Any help would be appreciated.
Thanks in advance
Sheetal
View Replies !
View Related
Boolean Help
I've made this code that just wont work:
onClipEvent (enterFrame) {
if ((_root.currentKey == "esc") && (_root.helpOn == true)) {
_root.helpmenu.gotoAndStop("off");
} else if ((_root.currentKey == "esc") && (_root.helpOn == false)) {
_root.mainMenuNav(5);
}
}
View Replies !
View Related
Boolean Help
I had posted earlier about a question and am still having problems on how to solve it.
My original post:
I have two movie clips on my main timeline. Inside each movie clip are the frame labels, "foreground" and "background". On the foreground state, an image moves to the foreground of the viewable area by use of a motion tween. On the background state, the image moves back to the background of the viewable area. This is set up similar to an advanced rollover.
From the main timeline, I can click on each mc to make it move back and forth. My next step is to create a variable and an if, then statement to check and see if one of the mc's has moved to the foreground state. If it has, then it needs to move back to the background to allow the other mc to take it's place.
I'm pretty sure this is possible, but I'm not quite sure how to go about it. When I create the variable, should it have a string or should it be a boolean? Do I need more than one variable? Within my if, then statement can I target a frame label inside a movie clip from the main timeline?
So, when I click on mc2, check to see if mc1 is on the "foreground" state. If it is, then move mc1 back to the "background" state, and move mc2 up to the "foreground" state.
Eventually, this will become about 6 or 7 mcs that will need to check and see if any are in the foreground, and if so, to move them back so that the selected mc can move up and swapp out the current mc. Make any sense?
After receiving a suggestion to use a Boolean variable, I placed in the following code:
girl2_mc.onRelease = function() {
if ( girl1_mc._currentframe == 21 ) {
girl1_mc.gotoAndPlay("background");
this.gotoAndPlay("foreground");
}
};
But, I'm still not getting it to work. Here is a link to my fla:
http://www.daveharperdesign.com/uploads/concept1.2.fla
thanks for any help that can be offered.
Dave
View Replies !
View Related
Boolean Maybe? HELP
Hey guys,
I have a problem
I am making a website with a flash menu. I want it to gotoAndPlay a particular frame (frame A) when the cursor is on a button. When you roll the cursor off of the button I want it to gotoAndPlay a different frame (frame B). That part was easy enough. But here is the problem. If you click on the button I want it to continue playing frame A even when you roll off.
Thanks
View Replies !
View Related
String 2 Boolean
hi!
thanks for looking.
Suppose I have a variabele called 'switch' and the contents is the string "true".
how do I convert the string to a Boolean ?
thanks in advance,
View Replies !
View Related
Boolean Array?
hi there...
I'm setting up a preloader and so i can check if each section has loaded i need use a list of boolean variables from
loaded1, loaded2 ... loadedXX
do i use an array for this? or is there a way of appending a counter onto 'loaded' ?
thanks, for your help,
m
View Replies !
View Related
Random Boolean Value?
Hey there...How do I apply a random visible property to a movie clip(either true or false)? I've been trying to use math.Random to accomplish this but I can't figure out how to use it to return a random Boolean value.
Thanks!
View Replies !
View Related
Boolean Variables?
Hi there.
Im just getting into action scripting and im trying to get my heasd round controlling MC's with enclosed buttons.
Here's the problem:
I have developed 5 individual dialogue boxes, which will be populated with text from text files.
These will sit in the main timeline. When the user clicks the button on the timeline (which is sitting in an MC) the dialog slides up.
Unfortunately the user can do this multiple times for each button and their related dialogues pop up over lapping the previous.
The dialogues have tabs so u can see the tab for each dialogue.
What i want to know is how do i go about it so that when a user clicks on a tab of a dialogue box it comes to the top (ie if it was the first open and 2 other dialogue boxes have been opened since and it is now at the bottom)
Ive tried picking apart various sample of dragging dilogues etc and cant figure it out. If someone could provide some skeleton code or a simple example solution it would be great.
Richard
View Replies !
View Related
Boolean Var Setting
K.I got the basics of this. But I am trying to do something very simple and probably will have it figured out by the time someone actually posts. If someone decides to be kind. Well here is my issue.
I have a button that when on release it tells my movie to play.. Ok. Well that is easy. Next, I wanted to make it to were it can only be pressed once. So I added a IF statement and made the variable a Boolean statement as well TRUE/FALSE what ever. And then on the MC that plays, on the inside of that is another button. To close the new opened MC. Basicly tell it to play again and then reset the variable. But it doesn't reset it. My code is below.
// My root button here. On my main screen. Plays movie if statement is FALSE else ignore basicly.
Here is a LINK to what I am working on.
Only the ABOUT button is in use right now.
http://vmagonline.net/spoke
on (release) {
if (Played_About == FALSE) {
var Played_About = TRUE;
tellTarget ("ABOUT") {
gotoAndPlay(2);
tellTarget ("Faces") {
play();
}
}
} else {
}
}
// This is my movie's button on the inside of the MC.
on (release) {
Played_About = "FALSE";
play();
}
View Replies !
View Related
Displaying Boolean Value
I'm stumped. This used to work in flash 5 is it different now.
Here's the situation:
one input field- numbers only, assigns input to variable in1
one dynamic field- assigned variable in2
one button that has the following script:
on (release, keyPress "<Enter>") {
in2 = (in1<100);
}
Which I believe passes along a boolean value to in2, so that either false or true is written in the dynamic text field. But nothing happens! What am I doing wrong?
View Replies !
View Related
Boolean Function?
Hey guys,
I made this function so that i can set certain parameters to equal true. It doesnt work for some reason. Can anyone shed some light as to why it wont return a true value for this variable?
_global.reset=function(input){
click_about=false;
click_port=false;
click_contact=false;
input=true;
}
I called the function like so
on (release){
reset(click_about=true);
Thanks guys
Don
View Replies !
View Related
Boolean Switching
Is there a way in which to swap the value of a boolean variable? I.e. if you multiply a number by -1 it swaps it from positive to negative and vice versa, is there a similar method for switching variables from true to false?
E.g. this should switch the value of myVariable each time button was pressed: -
code:
myVariable = false
on (release){
myVariable = myVariable *-1 //obviously doesn't work but u get the idea
}
It could be done using if...else I just thought this was a more 'proper' appraoch.
Cheers
View Replies !
View Related
Boolean Help 2.0 ... CONFUSED
Hi Everyone,
I'm new to actionscripting and somewhat new to flash and have a question.
I've begun a tutorial from a book. (Actionscripting, training from the source.) The first script added in this tutorial is:
var tvPower:Boolean = false;
function togglePower() {
var newChannel:Number;
if (tvPower) {
new Channel = 0;
tvPower = false;
} else {
newChannel = 1;
tvPower = true;
}
tv_mc.screen_mc.gotoAndStop(newChannel+1);
remote_mc.light_mc.play();
}
My question is ... and I don't know exactly how to put it into words, but ... how does it KNOW if tvPower is true or false?
Does the first line simply state that what state the clip is in now is false...and anything other than that would be considered true?
I'm so confused!!
Please help explain.
Thanks
View Replies !
View Related
Why Is This Boolean Always True?
Hi guys, in the change Listener below (about halfway down), does anyone know why I can't get the loadContent variables to ever equal false?
import mx.core.View;
import mx.containers.Accordion;
Accordion.prototype.falseUpSkin = "falseUpSkin";
Accordion.prototype.falseDownSkin = "falseDownSkin";
Accordion.prototype.falseOverSkin = "falseOverSkin";
Accordion.prototype.falseDisabledSkin = "falseDisabledSkin";
Accordion.prototype.trueDownSkin = "trueDownSkin";
Accordion.prototype.trueUpSkin = "trueUpSkin";
Accordion.prototype.trueOverSkin = "trueOverSkin";
Accordion.prototype.trueDisabledSkin = "trueDisabledSkin";
function setAccordionStyles(accordion) {
mainAccordion.setStyle("headerHeight", 22);
mainAccordion.setStyle("color", 0x00ffff);
mainAccordion.setStyle("fontStyle", "bold");
_global.styles.AccordionHeader.setStyle("fontSize" , 10);
_global.styles.AccordionHeader.setStyle("fontWeigh t", "bold");
_global.styles.Accordion.setStyle("backgroundColor ", "none");
_global.styles.Accordion.setStyle("borderStyle", "none");
}
setAccordionStyles(mainAccordion);
mainAccordion.createSegment("content1","s1","Not SO Dumb");
mainAccordion.createSegment("content2", "s2","small FART");
mainAccordion.createSegment("content3", "s3", "BIG heart");
//mainAccordion.createSegment("content4", "s4", "Segment 4");
//mainAccordion.createSegment("content5", "s5", "Segment 5");
// Create new Listener object.
var my_accListener:Object = new Object();
my_accListener.change = function() {
trace("Changed to different view");
// Assign label of child panel to variable.
var selectedChild_num:Number = mainAccordion.selectedIndex;
var loadContent1=false;
var loadContent2=false;
var loadContent3=false;
//var loadContent4:Boolean=false;
//var loadContent5:Boolean=false;
// Perform action based on selected child.
switch (selectedChild_num) {
case 0:
loadContent1=true;loadContent2=false;loadContent3= false;
trace("One was selected and content1 = " +content1 + " and contents 2, 3 = " + content2 + "," +content3);
break;
case 1:
loadContent1=false;loadContent2=true;loadContent3= false;
trace("Two was selected and content2 = " +content2 + " and contents 1, 3 = " + content1 + "," +content3);
break;
case 2:
loadContent1=false;loadContent2=false;loadContent3 =true;
trace("Three was selected and content3 = " +content3 + " and contents 1, 2 = " + content1 + "," +content2);
break;
}
};
mainAccordion.addEventListener("change", my_accListener);
I need to pass this to the info within the content (1,2,3 etc.) movieclips...if true, it does one thing, if false, it does another...
Thanks Kindly for any help
Shawn
View Replies !
View Related
[F8] Getting A Boolean Value From An XML File
I just checked the help files and realized that the global Boolean() function changed in Flash 7.
How do I get a boolean value out of an XML file? In 6, I used to have an attribute for a node that was 0/1 or true/false, when the node was read, I did the following:
myBool = Boolean(thexml.firstChild.childNodes[0].attributes.somevalue);
It would automatically convert 0/1 or true/false (strings) to the proper boolean value.
Now it returns true if the string has a length greater than 0.
I don't want my XML to contain empty attributes, I want either 0/1 or true/false to indicate the setting, but I don't want to clutter up my initialization routine with a bunch of conditionals (if (attribute == "true"), etc.)
Is there a clean, 1 step way to get a boolean value out of XML in Flash 8?
View Replies !
View Related
Boolean Newbie
I'm a total boolean newbie. As far as I can tell, with the research I've done on the net, this should work.
Basically the idea is that if the boolean (movieLoad) returns true then the movie will go back to the beginning "start".
Thanks in advance for any help I can get.
View Replies !
View Related
[F8] Boolean Toggle
Bleh. My code for my game isn't working, and I can't quite figure out why it doesn't.
Right now I'm trying to toggle a boolean function between true and false, and it works for making it true, but any code I use after it won't work.
Code:
if (GotHat == true && HatFlip == false){
_root.b3.onRelease = function(){
HatFlip = true;
TextBox.text = "You flip your hat inside out.";
}
}else if (GotHat == true && HatFlip == true){
_root.b3.onRelease = function(){
HatFlip == false;
TextBox.text = "You flip your hat rightside-out.";
}
} else if (GotHat != true){
_root.b3.onRelease = function(){
TextBox.text = "You don't have a hat to flip!";
}
}
Now, the first and last bit of code works. If you don't have GotHat activated, it'll display that message "You don't have a hat to flip!" and if you have GotHat activated, it'll turn HatFlip to true.
HOWEVER, even if GotHat is true and HatFlip are true, that second bit of code won't work, so you never see "You flip your hat rightside-out." I stuck "trace ("this works!")" in there, but I never see it in the output window, so I suspect that the code is being skipped over.
View Replies !
View Related
XML Objects As Boolean
Hi,
I'm trying to load an XML element as a boolean in the following:
Code:
<ThemeFormat Bold="true"/>
textFormat.bold = (XML.path.etc).@Bold;
However it doesn't work and either returns as false for a reason I don't know, either it returns true if I type:
= Boolean((XML.path.etc).@Bold);
as it's considered a Boolean statement declaration having an input;
How come Booleans aren't understood immediately, while I can do (path).@Color and (path).@Font without any problems (meaning strings and numbers)
What do I need to do in order to transform a String value (as it seems) into a Boolean without making an if statement. Is there another way?
View Replies !
View Related
[F8] My Boolean Is Resetting Anybody Know Why?
Hey guys I have the following code. For some reason the if statements are setting my 'myKey' boolean value to true every time. Any clues why? The intial trace works fine it shows both false and true so I know my previous code is working.
Code:
trace(myKey);
if (myKey=false){
gotoAndPlay("square");
trace(myKey);
}
if (myKey=true){
gotoAndPlay("circle");
trace(myKey);
}
Thank you!
View Replies !
View Related
String To Boolean
if i have a string from xml that reads "true" or "false" can i pass that as Boolean to flash? the result is always tracing "true" if i strict it to Boolean- but at times in the xml, the attribute is clearly false...
Code:
var b=(xml.item.@sailboats)//traces false...as is on xml
var c:Boolean=Boolean(xml.item.@sailboats)//traces true
if(b)
{
var sb:Sailboat= new Sailboat()
}else
{
this.visible=b
}
View Replies !
View Related
Possible To Pass A Boolean?
This is probably very simple but I can't work it out. I have lots of mc that I want to unhide and hide at various different times. Rather than writing this out long hand every time I want to create a function to do it. At the moment I have a function to hideMenu and one to unhideMenu something like the following...
hideMenu=functiom(){
holder1._visible=false;
holder2._visible=false;
backButt._visible=false;
//lots more mcs
};
And an unhideMenu where all the false are replaced by true.
It would be nice if I could combine these two functions and pass either true or false into the function. I tried something like the following but it isn't working...
button.onPress(){
hideMenu("false");
};
hideMenu=function(hidden){
holder1._visible=hidden;
holder2._visible=hidden;
//etc etc etc
};
I'm fairly new to AS so maybe this isn't even possible? Any help would be greatly appreciated.
View Replies !
View Related
Boolean Question
I am creating a gallery for my work and i need the button to change to a cross once it has been clicked so the user knows it has been there.
i found a tutorial which helped do this if you stay on the same page (i'm calling it the root menu).
my problem is, that when you click on the button it goes to another scene, and when you close the scene it will go back to the root menu, but the script i have used makes the button appear unpressed when you go back to the root menu and the cross is no longer there.
i have been given advise to create a boolean script see below
Have you tried make a boolean variable and if the boolean is true then go to and stop at frame one of the movie clip (the X), but if it's false then go to and stop frame 2 (the picture without an X). I'm not sure what the code would be for that exactly but it should work
however i am very new to action script and really dont know where to start.
any help would be greatly received.
sophie
View Replies !
View Related
Boolean Not Being Detected?
My trace is not detecting the boolean values from vBtns02 & vBtn03 being changed to true. Has anyone got the answer or suggestion?
Code:
var vBtn01:Boolean = false;
var vBtn02:Boolean = false;
var vBtn03:Boolean = false;
btn01.onRelease = function() {
movie01.gotoAndPlay("in");
if (movie01._currentframe == 02) {
vBtns01 = true;
if (vBtn02 == true && vBtns03 == true) {
trace("trace");
movie01.gotoAndPlay("out");
}
}
};
btn02.onRelease = function() {
movie02.gotoAndPlay("in");
if (movie02._currentframe == 02) {
vBtns02 = true;
if (vBtn01 == true && vBtns03 == true) {
movie02.gotoAndPlay("out");
}
}
};
btn03.onRelease = function() {
movie03.gotoAndPlay("in");
if (movie03._currentframe == 02) {
vBtns03 == true;
if (vBtn01 == true && vBtns02 == true) {
movie02.gotoAndPlay("out");
}
}
};
View Replies !
View Related
Button Boolean
So, for years I've been coding using snippets of code and simply knowing what they do was enough to get the job done without any deadlines. However times change and today for the first time its like when you are tucked in bed as the sun is going down reading your Sweet Pickels books and realizing for the first time you can read, those words really aren't an illusion; I can actually code. Anyway moving on...
so.. I am gathering the best method to make this movie.
Each button in this movie goes to an xy axis. Im getting hung up on a couple of items on how to code this.
I need to control each button as to where that button is taking the movie, but assigning those buttons a boolean statement to say if the next button is clicked to stop going to those xy coordinate and go to the ones previously selected.
The boolean is hanging me up. Any suggestion?
View Replies !
View Related
Casting To Boolean From XML
How would you get Flash to recognise a value passed via XML as a boolean true/false...
Ive tried casting it to force it to be Boolean, which I think ive done correctly as:
ActionScript Code:
var run:Boolean = Boolean(xmlData.run.text())
Ive also tried removing the .text() however it always goes true, anyone know what i'm doing wrong...?
View Replies !
View Related
AddEventListener To A Boolean
Good morning!
I wonder if it is somehow possible to do this:
ActionScript Code:
var thing:Boolean = true
thing.booleanvalue.addEventListener(Event.CHANGE,changed)
function changed (e:Object) {
trace("the thing was changed to ",thing)
}
thing=false
As of now, I'm getting this as a result:
1061: Call to a possibly undefined method addEventListener through a reference with static type Boolean.
That probably means I cannot add a listener to a Boolean or a String Object
Maybe I could to this to an Object instead?
Tried out and NO.
ActionScript Code:
var thing:Object = new Object()
thing.booleanvalue= true
thing.booleanvalue.addEventListener(Event.CHANGE,changed)
function changed (e:Object) {
trace("asi was changed to ",thing.booleanvalue)
}
thing.booleanvalue=false
TypeError: Error #1006: value is not a function.
Is there a workaround other than running an interval to see if the value has changed?
Martin.
View Replies !
View Related
Boolean Question
Hello there actionscript experts! I am trying to test if a boolean is true or false. I have set a variable to false and have a condition where I test if it is true or false, however, the condition never does what is is supposed to. Here's an example.
ActionScript Code:
var boolean:Boolean = false;
start_btn.addEventListener(MouseEvent.CLICK, setBoolean);
function setBoolean(event:MouseEvent):void
{
boolean = true;
}
if (boolean == true)
{
trace("It Worked!");
}
However "It Worked" never appears WHY?!
Any help would be greatly appreciated!
View Replies !
View Related
String To Boolean
I have an event listen that sets some values:
ActionScript Code:
public function dataSaved(e:Event){
isGood = Boolean(saveData.data);
opt = saveData.data;
dispatchEvent(new Event(Event.COMPLETE));
}
isGood is supposed to convert the output to a boolean true or false value, but it always evaluates to true for some reason.
opt is what displays the actual returned data, sometimes it is true and sometimes it is false, so if the text comming from that file says false, why does it convert the Boolean value to true?
View Replies !
View Related
Boolean Function?
Ok basically i want to write some code that checks wether a move is valid or not...
again my java days tell me this can be done but i cant seem to do it in action script...
What i want is basically
ActionScript Code:
function generateNumber(number)
{
this.number = number;
}
generateNumber.prototype.isValid = Function()
{
if(number == 3)
{
return true;
}
else
{
return true;
}
}
So that i can do number.isValid and if true it adds it to the array, If false it doesnt
Any help apreciated, and wether this generateNumber.prototype.isValid is the way it should be as well
View Replies !
View Related
Boolean Logic
hey. I was wondering if somebody could help me out. i'm writing a game in where a object ("the hero") is controlled with keypresses and when comes into contact with other objects, it trails the "hero" until it comes into contact with a box movieclip in the corner, when the trailing object is dropped. i have 4 objects which i can "pickup" and "drop" but i only want one trailing object at any one time. I've tried various boolean and conditional statements but all fairly unsuccessfully. heres the code for 2 of the objects
thanks for looking!
Attach Code
for(var i = 0; i < objectA.length;i++)
{
//NEED A CONDITIONAL STATEMENT HERE, SO ONLY ONE ANSWER CAN BE COLLECTED
//=---------------------trailing object A
if(this.hitTest(this._parent.objectA[i]))
{ this._parent.objectA[i].booleanVar1 = true; //if hero hits answer a, trail
}
if(this.hitTest(this._parent.objectB[i]))//if answer a hits answer box - drop it
{ this._parent.objectA[i].booleanVar1 = false;
}
//-------------------------trailing object B
if(this.hitTest(this._parent.objectC[i]))
{ this._parent.objectC[i].booleanVar2 = true; //if hero hits answer b, trail
}
if(this.hitTest(this._parent.objectB[i]))//if answer b hits answer box - drop it
{ this._parent.objectC[i].booleanVar2 = false;
}
}
View Replies !
View Related
How To Evaluate NaN As Boolean
hello everybody, and a merry christmas to you all!
question time: using:
var num:uint = uint( "_5" );
if ( num == NaN ) num = 5;
produces this warning:
Warning: 1098: Illogical comparison with NaN. This statement always evaluates to false.
obviously the syntax is 'bit wrong. what would be right? :)
Edited: 12/20/2007 at 07:50:13 AM by dubya
View Replies !
View Related
Random Boolean?
public var doflip:Boolean;
doflip = Math.floor(Math.random()*2);
can have 0 or 1 as outcome, always worked fine in AS2.0, now in 3.0 it gives
Warning: 3590: Number used where a Boolean value was expected. The expression will be type coerced to Boolean.
Nevertheless, seems as flash resolves it himself since it works..... but error is annoying. Anybody any non-error solution?
P
View Replies !
View Related
Component Help W/boolean Value
I am trying to develop a multiple choice quiz using learning interactions (components)
It will be a series of 4 checkboxes, and if the checkbox chosen is wrong a certain mc will play, and if it is right a different mc will play.
So far, I have 2 tests going and I realize that I need to set
a boolean value to true in order for this to work the way I want.
When I have this code the mc plays as soon as the movie starts:
<hr>
function onChange(component)
{
if (component._name == "Checkbox1")
_root.attachMovie("wrong1","wrong2",200);
}
<hr>
Well, I realized I had not told it to play only if the instance "Checkbox1" is true, so I tried this:
<hr>
function onChange(component)
{
if (component._name == "Checkbox1" && "Checkbox1" == true)
_root.attachMovie("wrong1","wrong2",200);
}
<hr>
When I preview the movie and select "Checkbox1" , nothing happens.
I wonder do I need to use an else if statement rather than trying to put it in the same section as the name equals, or what?
I am not sure what I am doing wrong.
Also, when the mc was playing (in the first example) it was cut off, only half the clip was showing. Any ideas about this as well?
View Replies !
View Related
Boolean From The LoadMovie?
i'm trying to test wether an image i'm loading into a MC has be loaded.
Its an xml gallery and i'm trying to get it to send out an error message if the image can't be loaded - cos its no there etc.
i've been trying to get some sort of boolean value from the:
loadMovie(Vimage, imageHolder);
that i use to just load in the image, but i can't seem to get anything to work.
I've resorted to:
if (ImageSize==0){
loadingDIS="ERROR LOADING IMAGE";
}else {
loadingDIS="LOADED IMAGE";
}
where ImageSize is the getBytesLoaded(); value for the loading image [if there isn't one then it should be 0]. But this seems to run one image behind itself....??
does anyone know how to accomplish this effectively??
View Replies !
View Related
XML Boolean Attribute
I built a simple XML file with a false attribute to show/hide a movieclip on the stage. But once the XML is loaded, flash is not using the false value from the XML document to make the movieclip disappear using the '_visible'.
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<myNodes hideVar="false" />
I use Grant Skinners XML2 loader and use the following code in the flash file:
Code:
// import the class
import com.gskinner.net.XML2;
myXML = new XML2();
// subscribe to its load event:
myXML.addEventListener("complete",this);
// subscribe to its httpStatus event:
myXML.addEventListener("httpStatus",this);
// set the timeout period to 20 seconds (default is 30 seconds):
myXML.timeout = 20000;
// set the connection timeout period to 8 seconds (default is 6 seconds):
myXML.connectionTimeout = 8000;
// This is where you put the file URL:
myXML.load("values.xml");
myXML.ignoreWhite = true;
// function to handle the load event:
function complete(p_evtObj:Object):Void {
var XMLObj:XML = p_evtObj.target;
trace("success: "+p_evtObj.success);
trace("status: "+XMLObj.status);
trace("toString: "+XMLObj.toString());
xmlArray(XMLObj);
}
// function to handle the httpStatus event:
function httpStatus(p_evtObj:Object):Void {
trace("http status: "+p_evtObj.httpStatus);
}
function xmlArray(XMLContent){
var hideVarible:Boolean = XMLContent.firstChild.attributes.hideVar;
trace("hideVarible: " +hideVarible);
boxClip._visible = hideVarible;
}
Am I missing a step to make the variable a Boolean? Any help will be greatly appreciated.
View Replies !
View Related
Checking The Boolean Value Of A Statement
In my script, I have to continually check for the boolean value of a statement in a function. I have set the statement as follows:
statement = "i<100";
Now how can I check if the statement is true or not? I thought this
booleanValue = eval(statement);
would do it, but it returns "undefined".
Thanks in advance!
View Replies !
View Related
Movie Clips And Boolean?
I have several movie clips, all identical in animation (they nake a physical button rise and fall, like a switch). I want to play one movieclip (depress the 'switch' in a main menu) that will tell several other clips to play (raise other 'switches' in a sub-menu). The hang up is when I select other clips (other 'switches' from the main menu) I want the clips that were activated by the past button, as well as the past button (first main menu 'switch') to play backwards (making the sub-menu buttons fall back down, and the first main menu button rise up).
Does that make sense???
I don't know how to make the movie clip play backwards or forwards based on the properties of other movie clips.
I think what I need is some sort of 'if ___ is ____ then _____'
>>>>>>>>> Can anyone help...
Christian
View Replies !
View Related
HLP>boolean Variables &buttons
Hi there.
Im just getting into action scripting and im trying to get my heasd round controlling MC's with enclosed buttons.
Here's the problem:
I have developed 5 individual dialogue boxes, which will be populated with text from text files.
These will sit in the main timeline. When the user clicks the button on the timeline (which is sitting in an MC) the dialog slides up.
Unfortunately the user can do this multiple times for each button and their related dialogues pop up over lapping the previous.
The dialogues have tabs so u can see the tab for each dialogue.
What i want to know is how do i go about it so that when a user clicks on a tab of a dialogue box it comes to the top (ie if it was the first open and 2 other dialogue boxes have been opened since and it is now at the bottom)
Ive tried picking apart various sample of dragging dilogues etc and cant figure it out. If someone could provide some skeleton code or a simple example solution it would be great.
Richard
View Replies !
View Related
Trouble With Boolean RollOver
I have a function that moves a mc at the point clicked to the center of the stage. What I've been trying to do (unsuccessfully) is to have the mc only move when I click on it, not anywhere else on the stage. My code seems correct to me, but it seems to respond no matter where I click. Any help for me out there? Pleeease?
code:
myMC.onRollOver = function() {
this.over = true;
this.off = false;
}
myMC.onRollOut = function() {
this.over = false;
this.off = true;
}
//Moves mc from point of mouse click to center of stage
function centerMove() {
myPt = new object();
myPt.x = this._xmouse;
myPt.y = this._ymouse;
this.localToGlobal(myPt);
var distX = (((Stage.width)/2) - myPt.x);
this._x = this._x + distX;
var distY = (((Stage.height)/2) - myPt.y);
this._y = this._y + distY;
}
_root.onEnterFrame = function () {
if (myMC.over = true) {
myMC.onMouseDown = centerMove;
} else {
return;
}
}
View Replies !
View Related
Simple Boolean Question -- PLEASE
Can someone PLEASE tell me why this does not work?
var c = 1;
var v = 1;
//
this["testData"+c]["h"+v] = 80;
trace("testResult= " + (this["testData"+c]["h"+v]));
The result is:
testResult=
I want to construct a set of variables that look something like:
this.testData1.h1;
this.testData1.h2;
etc.
I guess there is still something I don't understand about Booleans?
P.
View Replies !
View Related
Whats Up With The Success Boolean?
onClipEvent(load){
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
this._parent.result_ta.text = "AAAIIIIIIIIIIIIIIIII";
} else {
this._parent.result_ta.text = "Error connecting to server.";
}
}
var send_lv:LoadVars = new LoadVars();
send_lv.name = "GOOOOOTCHHHHHAAAAAAAAAAAAAA";
send_lv.sendAndLoad("test2.cgi", result_lv, "POST");
}
I can't see how this returns any value. Does the success boolean thing work no matter what you send the data to? The result_ta doesn't show anything, not even the error message. What am i doing wrong?
View Replies !
View Related
|