ActionScript 2.0 :: If Else Always Returning A 'true' Value?

Mar 7, 2010

I am makign something which generates a random number, then proceeds to check it against a range of fields loaded from an XML file. I have checked and the fields are loading the correct numbers in, but the "if" statement is always returning 'true'. The only time I have been able to get it to properly execute is when I use numbers instead of variables. I have tried using Number(variable), but that doesn't seem to fix anything. here is my code.

ActionScript Code:
on (release) {
_root.colnum = Math.round(Math.random()*100); 
if ((_root.colnum<=_root.wballmax) && (_root.colnum>=_root.wballmin)) {

[Code]....

View 5 Replies


Similar Posts:


ActionScript 3.0 :: HitTestObject Always Returning True?

Jun 1, 2010

I'm having some trouble with an Asteroids game I'm making as a first game. The issue I'm having is that I'm trying to do hit detection using a for loop that runs hitTestObject against every item in an array, but every time it runs it returns true no matter where the ship or the asteroid are on the stage.Here is my code:

Code:
function setup() {
stage.addEventListener(KeyboardEvent.KEY_DOWN, keypress);

[code].....

View 2 Replies

ActionScript 2.0 :: Returning True Or False Value From An External Website?

Nov 11, 2009

From my flash file I need to make a call to an external link, and retrieve a value which is either "true" or "false".This website will display either:<resp>false</resp> or <resp>true</resp>I have no influence on the external link - so I can't add anything to that file.Depending on the returned value, I want to do something simple like:

ActionScript Code:
if(true) {
//DO SOMETHING

[code].......

View 3 Replies

ActionScript 3.0 :: ButtonMode = True; .useHandCursor = True; Only Works On Half Of The Button?

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

ActionScript 2.0 :: If Condition - (condition1=true) AND (condition2=true)?

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

ActionScript 2.0 :: Read "true" As True?

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

ActionScript 3.0 :: Selectedcolor, True To The Text True Or False In The False Print Text?

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

ActionScript 3.0 :: Returning The SWF Url?

May 19, 2010

In as 2.0 there was a simple code like trace(_root._url) that would return the url of the actual swf file. What is the equivalent in AS3? The samples I found were all realted to window.location and other things, is there no simple code for this like in as 2?

View 3 Replies

Actionscript :: Returning A Value From Php To Swf?

Jul 4, 2011

I am trying to transfer a movie-clip staged in a swf(on local machine) to a remote server. Below is a part of the action-script code concerned with it;

function createJPG(mc:MovieClip, n:Number, fileName:String) {
trace("sdf:");
var jpgSource:BitmapData = new BitmapData(mc.width,mc.height);
jpgSource.draw(mc);

[Code]....

I want to close the swf when the upload is complete., I would like to know how to return a value(may be a number which I intend to use to indicate completion of file transfer) from the php script to the swf and how to receive that value in the swf?

View 2 Replies

ActionScript 3.0 :: Returning More Than One Value?

Jul 14, 2009

ActionScript Code:

var temp = 1
function change(out){
out = 2
return "something"

[code]....

(I would do this if I had a function that returned a value already and I needed it to output more information - I'd pass it an output variable which it would fill for me)but in AS3 that doesn't seem to work - it seems changes I make to a function argument apply only within the function.

View 7 Replies

ActionScript 3.0 :: Set The Caption To True?

Aug 7, 2009

I can set captioning to true in component inspector; is there any other way that we can set the caption to true?

View 1 Replies

Flex :: Get A True MouseOver?

May 20, 2010

so mouseOver and RollOver, and their respective outs work great as long as your mouse is actually over the item, or one of it's children. My problem is that I may have another UI component "between" my mouse and the item I want to process the mouse/rollover(maybe a button that is on top of a canvas, but is not a child of the canvas). The mouse is still over the component, there's just something else that it's over at the same time.

Here is a simplified code example detailing my question copy/paste that into your flex/flash builder and you'll see what I mean:Edit, I just made this more complicated and true to my actual problem, drag slowly, if you move your mouse further than the button in a single frame it kinda breaks, but that is just in this simplified version

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="500" height="268"

[code]....

View 1 Replies

ActionScript 3.0 :: Returning A Value From A Function

Apr 6, 2010

I have an external function that needs to return a customerID value. However, it seems to be returning the initial value instead of the value that I believe is being set within the function.[code]

View 2 Replies

ActionScript 3.0 :: Mc Not Returning To State?

May 5, 2011

only issue i'm having is that if i drop the item in the zone requiring a change, and pick the item back up, it combines the shapes. I'm thinking I need to have the if statement more universal. I've uploaded my fla to rapid,I'll put my coding below as well.

backbutton.addEventListener(MouseEvent.CLICK, backclick);
helpbutton.addEventListener(MouseEvent.CLICK, helpclick);
answerbutton.addEventListener(MouseEvent.CLICK, answerclick);

[code].....

View 4 Replies

Flex :: Returning The Value Of A New CheckBox In Air?

Oct 31, 2009

I am trying to save settings to an XML File and setting the relevant data if the check box is checked or not.

private static function createXMLData():void
{
prefsXML = <preferences/>;
prefsXML.application.@windowsstart =

[Code]....

well i assume that is what the error means, it cannot get details of something that is not set yet.. so how would i get it to check and if nothing then it is obviously a "false".

View 5 Replies

Returning Errors From AMFPHP?

Mar 19, 2010

When using flash remoting with amfphp, what can I write in php that will trigger the 'status' method that I set up in my Responder in Flash? Or more generally, how can I determine if the service call has failed? The ideal solution for me would be to throw some exception in php serverside, and catch that exception in flash clientside... How do other people handle server errors with flash remoting?

[Code]...

View 1 Replies

ActionScript 2.0 :: Ns.onStatus Not Returning A Value?

Jan 22, 2009

The following snippit:

// FLV Completion
ns.onStatus = function(info){
if(info.code == "Netstream.Play.Stop"){

[code]....

Is not returning anything at the end of my flv. I have also tried: Netstream.Play.Complete to no avail.

View 1 Replies

Actionscript 3.0 :: Getter Not Returning Value

Jan 14, 2009

I have a setter and getter method , the getter method should return an array collection but it's always returning an empty array collection even when I've run trace to check on it.[code]...

View 1 Replies

Actionscript 2.0 :: Ns.onStatus Is Not Returning A Value?

Jan 22, 2009

The following snippit...

ns.onStatus = function(info){
trace("The movie has ended keptain!");
if(info.code == "Netstream.Play.Stop"){

[code].....

View 2 Replies

ActionScript 2.0 :: Returning The INSTANCE Name?

Sep 10, 2004

i have a MC, that contains a button, and when i press that button i need it to send the instance name of _parent.MC (instance name is "kala") to the variable "_root.eelmine".result must be: _root.eelmine = kala;

View 2 Replies

ActionScript 2.0 :: Returning A Value From A Function?

Nov 2, 2005

well I have a function in my index.swf that goes like this

Code:
function getLanguage(language):String {
var sLang:String = language;

[Code].....

View 5 Replies

ActionScript 2.0 :: Returning Value From Function?

Dec 14, 2007

I have the following function defined in a class:

Code:
vidNetStream.onMetaData = function(myMeta){
_root.totalDuration = myMeta.duration;
//trace(_root.totalDuration + "!");
}

totalDuration is a private variable defined in my class.... how can I get that function to effectively save totalDuration?

View 2 Replies

ActionScript 2.0 :: Returning A Value From A Class?

Aug 5, 2008

I decided to turn this util into a class because I use it in almost all of my projects. Basically what it is is I import an XML file and it has all these HTML characters like & or   and my function basically converts those strings of characters to its regular form ie: ['&' (&] or [' ' ( )]

so calling it in a FLA file would be something like this:

Code:
var entity:DeEntitizeHTML = new DeEntitizeHTML("bob & jim");
and here is my class file:
Code:
class com.dop.DeEntitizeHTML
{
function DeEntitizeHTML(my_str)

[Code]....

how to return that value back to the var entity in my FLA.

View 1 Replies

ActionScript 3.0 :: Returning A Class Name?

Sep 11, 2009

Is there any method that returns the Class name of an instance as a String? I would like to then pass that String as the parameter into the getDefinitionByName() method to create a new instance of that Class (whatever it is).basically, whatever I have stored in the variable 'currentPage' (which could be any number of classes I haev written), I want to create a new instance of (therefore re-instantiating it). this will then act as the method for a 'reload' button which is designed to reload whatever the current page/activity is.

View 5 Replies

ActionScript 2.0 :: Flash 8 - How To Get True Fullscreen

Apr 4, 2009

I m designing a webpage in flash. Actually I am looking for fullscreen for my webpage. I know some methods to do it, but with that, the position of the page contain not changes as per browser window's size. I have used below code, but what i want exactly for that see this website: [URL].

The code that I used is below.
Stage.align = "TL";
Stage.scaleMode = "noScale";
function modoFullScreen() {
Stage["displayState"] = "fullScreen";
} function modoNormal() {
Stage["displayState"] = "normal";
[Code] .....

View 2 Replies

Mc.visible = True Button Not Working?

Jan 2, 2010

I'm using Flash Cs4 with As3 to make a project. In part of it I have an object which is invisible, but when a button is pressed is made visible. Only problem is, it won't make it visible.

Heres my code

PHP Code:

import flash.events.Event;import flash.events.MouseEvent;aSettings.visible = falsevar setVisible:Boolean = false;buttonVisibility.addEventListener(MouseEvent.MOUSE_DOWN,function():void

[Code]....

I'm not receiving any errors at all, but whenever I click the button the output says "false", so I know that its not changing it to true.

View 2 Replies

Visible Property Does Not Work For True

Apr 17, 2011

I have a clip which is basically a set of button clips. When a button is clicked it fades (i used the ._alpha property) and finally when its 0 alpha, it removes itself (by using _visible=0 property). It works perfectly. Now when another button is clicked. I wanted the button which is currently not visible to restore its visibility. But using _visible=1; just isnt doing it (pastbutton._visible=1;). I tried a lot of trouble shooting, trace shows that the correct button path of the last invisible button is stored in pastbutton. But still when the next line says pastbutton._visible=1 still it doesn't restore the target button which is stored in the pastbutton variable.

View 1 Replies

Button Pressed True Or False?

Nov 4, 2009

Basically what i have is three buttons which can be pressed in a maximum of 7 different combinations. Each of these buttons has a movieclip underneath that advances to the next frame when the button is pressed. Each clip has two frames with actions,  frame 1 has:
 
stop();
var option1:Boolean = false;
and then frame 2 has:
stop();
var option1:Boolean = true;
 
So when you press a button you have true, and false when the button is pushed again.
 
i already have a constant loop between frames 2 and 4. At frame 4 i think i need to have some code that detects which state the 3 boolean statements are in and then load a movie depending on which statements are true and which are false.

View 6 Replies

ActionScript 2.0 :: Possible To Set Vars Like True And False In XML?

Apr 25, 2007

I never get the hang of these.'
Code:
_global.web_link_activate = (wArray[this.id]);
if (_global.web_link_active == "no"){
_root.load_area.zoomer.enabled = false;
_root.load_area.zoomer._alpha = 20;
[Code] .....
That should work but it does not. it always says "yes" wArray is a drawn from an xml document.

XML is
Code:
weblink="yes"
Can I set vars like true and false in xml kinda like weblink=false??

View 6 Replies

ActionScript 3.0 :: HitTestPoint( X, Y, True); Implementation?

Jun 2, 2009

Testing this function and running it 11k times on a shape where I use:
 
shape.opaqueBackground = true;            shape.cacheAsBitmap = true;
 
Is extremely slow.. It seems to take 4 to 5 seconds to check a 101 x 101 tectangular area.I'm wondering how it is implemented...I know the code for the SDK is available?I can 'getPixel' from a bitmap to get the very exact color of that pixel in 1/1000 that time.If I happen to have the bitmap data.But with a shape that is already 'treated as a bitmap' (see above) using hitTestPoint  can stop your system. It should not be vastly inferior to work with Shapes than it is with bmp data..

View 3 Replies







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