Thursday, October 18, 2012

Actionscript variable type checking

Guys,
If you want to check a type of a variable, that means you want to know the variable is a string or an array or an object etc.... use this code

Code:
var A:Array = new Array();
var B:String = new String();
var C:Object = new Object();
trace (getQualifiedClassName(A));
trace (getQualifiedClassName(B));
trace (getQualifiedClassName(C));

Result:
Array
object
String



Happy coding..
Ramesh Palleri

Sunday, August 21, 2011

Orientation of Flex application in phone

Guys,
You can keep you flex application landscape or portrait
Or you can keep both, that will be the default view of an app. According to how th eperson holds a phone, it will automatically adjust.
lets check how to do that
open the applicationName-app.xml

landscape:
false
landscape

portrait:
false
portrait



Tuesday, June 30, 2009

Send querystring variable to Flex application.

Hi man, This may help you to send a variable to to your Flex application while loading that in to the browser.

The url will be,
somename.com?utlVariable=lethimgo

Open the projectname.template.html from html-template folder. Declare a global variable, this will hold the value of the variable you pass through the URL

var javascriptVar = getquery_Value( 'utlVariable' );

//returns the value of the url variable
function getquery_Value(varName)
{
varName = varName.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
var regexS = "[\?&]"+varName+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}



Now you have to edit in 3 places... Pass the variable to the flex application as FlashVar.

// embed the Flash Content SWF when all tests are passed
AC_FL_RunContent(
"src", "${swf}",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer",
"FlashVars", "accessPermission="+javascriptVar
);

.........................................
...........
...........................



id="${application}" width="${width}" height="${height}"

codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">


width="${width}" height="${height}" name="${application}" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer"
FlashVars="accessPermission="+javascriptVar>




Now in the main file...

private function creationcomplete():void{

if(parameters.accessPermission=="lethimgo"){
//Access permitted, you may go now
}else{
// Access denied, go away...
}

}





Enjoy..!