Tag Archives: Alert

How to add sprite to a body in Box2D in Adobe AIR, FLEX and FLASH? Or Add image/Sprite to a body in ActionScript.

By | April 12, 2012

The below code is for FlashBuilder 4, If you are using FlexBuilder3 use addChild() instead of the commented block in the following code. [java] public function addCircle(){x:Number, y: Number, radius:Number, ballcip:Ball):void{ bd:b2BodyDef = new b2BodyDef(); var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, imageFailed); var request:URLRequest = new URLRequest("ball.png"); loader.load(request); /*optionally change the position of the image if not fitting… Read More »

How to drag and drop a file from outside to your flex or AIR application and render it correctly?

By | April 7, 2012

Actually we have to do this by registering your application with the eventlisteners for NATIVE_DRAG_ENTER and NATIVE_DRAG_DROP. The following code shows how to do this. Just copy and paste the code to your MXML file and see the result. Drag and drop an image file from outside to your AIR application. import mx.controls.Alert; import mx.controls.Image; import flash.filesystem.File; private… Read More »

Show Alert in cocos2D Android.

By | February 4, 2012

Here is a simple example showing alert in android cocos2D. For this I am using an example from my previous android cocos2D tutorial.. So please read that tutorial before reading this because the I am using the classes and files from it. I am only changing the Gamelayer.java file to show an Alert Dialog when the sprite move… Read More »

Access a remote database from Adobe AIR or FLEX.

By | February 8, 2011

Access a remote database from Adobe AIR or FLEX. Many often you need to access online database from your application. For doing it in Adobe AIR of FLEX you need HttpService. The following example shows how to access an online database from an AIR Application. Note that you cannot return an array from a remote file or database,… Read More »

Pass a variable from one window to another in Adobe AIR?

By | February 6, 2011

We often need to access another window variable in the current window. The following example shows how to access a variable from one window in the next window. The logic is to create an object of next window in the current window and assign the value of variable in the current window itself so that it becomes available… Read More »

How to Implement Box2D in Adobe AIR?

By | February 4, 2011

Everyone will be fascinated how flash games are built on the web that implements the real world physics. Well for your information there are a lot of physics engines available. One of them is the Box2D. Box2D was written in C++. Then it was converted to flash. So now I am going to show you how to build… Read More »

Add Context menu in Adobe AIR or FLEX.

By | January 15, 2011

This sample shows how to add a menu to your context menu or the right click of your menu in Adobe AIR. AIR Uses the ContextMenu class to add menu to your mouse right click. import flash.events.ContextMenuEvent; import mx.controls.Alert; // call this function to create context menu in AIR and FLex private function createContextMenu():void { var myContextMenu:ContextMenu =… Read More »

How to refresh a page in Adobe Flex?

By | December 26, 2010

In the following code the navigateToURL property is navigating to the same page which creates the refreshing of the page. [xml] <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="1024" applicationComplete="init()" minHeight="768"> <mx:Script> <![CDATA[ import flash.net.navigateToURL; import mx.controls.Alert; private function init():void { } protected function button1_clickHandler(event:MouseEvent):void { navigateToURL(new URLRequest("javascript:location.reload(true)"), "_self"); var urlRequest:URLRequest = new URLRequest(Application.application.url); navigateToURL(urlRequest,"_self"); } ]]> </mx:Script> <mx:Button… Read More »

How to Skin your Alert or ToolTip in Adobe Flex using actionScript?

By | December 26, 2010

The code below does this . Simply copy and paste the following code.. applicationComplete=”init()”> Alert { color : #124332; background-color: #ffffff; header-colors : #243322, #243322; header-height:19; drop-shadow-enabled: true; drop-shadow-color :#243322; corner-radius :10; border-style :solid; border-thickness: 1; border-color : #243322; footer-colors : #243322, #ffffff; title-style-name : “title”; } .myalertstyle { backgroundAlpha: 0.3; backgroundColor: black; borderAlpha: 0.3; borderColor: white; dropShadowEnabled:… Read More »

How do you call an actionscript function from a html page and viceversa. How to you access the actionscript variable function from an HTML page in actionscript.

By | December 26, 2010

The following code helps you to do this. Save the following  code as am .mxml file [xml] <?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"> <mx:Script> <![CDATA[ private var calledFromJSHandlerFunction:Function = calledFromJSHandler; private function init():void{ html.addEventListener(Event.HTML_DOM_INITIALIZE, domInitialized); html.location = "start.html"; } private function domInitialized(event:Event):void{ html.htmlLoader.window.calledFromJSHandlerFunction = calledFromJSHandlerFunction; } private function calledFromJSHandler():void { mx.controls.Alert.show("ActionScript called from JavaScript", "Alert"); } private… Read More »