Boolean with FlashVars problem

196 views
Skip to first unread message

Alama

unread,
Jun 9, 2012, 10:39:12 AM6/9/12
to SWFObject
Hi,

I use swfobject 2.2 and i have a problem with flashVars (with boolean
only).

var flashvars =
{
booleanVar: false
}

Dont work in flash.. :S

I tried "false", 0, "0".. nothing work.

in AS3, i get like:

booleanVar = this.loaderInfo.parameters.booleanVar;

but my booleanVar is always true ..

Thanks everybody.

Nathan Mynarcik

unread,
Jun 9, 2012, 12:22:48 PM6/9/12
to swfo...@googlegroups.com

Try

var flashvars = {};
flashvars.boolVar = "false";

all else fails, use the online generator: http://www.bobbyvandersluis.com/swfobject/generator/index.html

--
You received this message because you are subscribed to the Google Groups "SWFObject" group.
To post to this group, send email to swfo...@googlegroups.com.
To unsubscribe from this group, send email to swfobject+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/swfobject?hl=en.

Alain Mazy

unread,
Jun 9, 2012, 2:41:31 PM6/9/12
to swfo...@googlegroups.com
Hi Nathan, thanks for your reply.

I tried surround false by " but, it's no change for me..

My script it's generated by FlashDevelop4, the real script is:

        var flashvars =
        {
            btnOneShootText: "ONE SHOOT",
            btnAutoShootingText: "AUTO SHOOTING",
            btnCancelShootingText: "CANCEL SHOOTING",
            btnValidatePhotoText: "VALIDATE",
            uploadProgressText: "Upload in progress.. ",
            uploadSuccessText: "Upload Success!",
            shootsMax: 10, //qty
            timeShootMin: 50, //ms
            timeShootMax: 2000, //ms
            ShutterAnimation: false, // no shutter = "", shutter animation = true
            urlNavigateWhenFinish: "capture", // never navigate = "" , navigate to jpg result = "capture", other = "your url"
            universalDataTransmitToUploadHandler: "id_client", // facultative, it's transmitted by GET at output
            urlUploadHandler: "write_jpg.php" // abasolute or relative
        };

it's no correct?

Thanks :)

Fabien Auréjac

unread,
Jun 9, 2012, 5:25:56 PM6/9/12
to swfo...@googlegroups.com
Did you try transtyping the Boolean under Flash by the sentence:
booleanVar=Boolean(this.loaderInfo.parameters.booleanVar);
??

don't know at all if this could fix it.

best regards,

Fabien


Fabien Auréjac
0672631545
skype: fabienaurejac


Aran Rhee

unread,
Jun 11, 2012, 11:19:51 AM6/11/12
to swfo...@googlegroups.com
As Nathan suggested, all flashvar values come through to Flash as Strings. You'll need to do an extra check within Flash if you want to do Booelan comparisions. Here is a simple test etc:


var f : String = "false";
var t : String = "TRUE";

function isTrue (val : String) : Boolean
{
if (val.toLowerCase() === "true")
return true;
return false;
}

trace(Boolean(f) === false); // returns false, as even typecasting does not equate 
// if you were to var the typecasting operation like var bf : Boolean = Boolean(f); 
// and debug you would see bf is actually = true ! (surprising as that may seem)

trace(isTrue(f) === false); // returns true as expected
trace(isTrue(t)); // returns true as expected

Anyway, use the isTrue() function etc within your swf, and you're good to go.


Cheers,
Aran
plume.jpg

Alain Mazy

unread,
Jun 11, 2012, 11:33:20 AM6/11/12
to swfo...@googlegroups.com
Haha! thanks Aran ;)

@ Fabian, i tried casting in AS3, but without success ..

My solusion is in FlashVars = "", loaderInfo.parameters.booleanVar; is false (defaut value)
and if my flashVars = anything, my boolean = true.. :)  It's special, but it works.

therefore,

flashvar = "",  > return false, in all other cases > return true.

Sorry for my english ;)

Alain.
Reply all
Reply to author
Forward
0 new messages