actionscript-3 – Adobe Air integrate Flex Components

Question:

I'm developing a project using Adobe AIR and Action-Script 3, I found that the UI Components don't have support for mobile, ie on Android or iOS they don't scroll down and up with my finger.

From what I understand, which has this functionality is the Flex Framework. is it possible to integrate the Flex components for the current project that is in AIR? If yes, how?

Technologies:

Adobe Flash Professional CC 2015 Adobe Flash Builder 4.7 Adobe AIR 18

Answer:

You will not be able to use Flex libraries in AIR AS3 because they have different SDKs and compilers . The Flex SDK is almost an extension of the AIR SDK, but not fully supported as there are different project file and folder structures.

What you can do is convert your application. This process involves the migration of libraries, visual objects and folder structure, which makes it very laborious to do.

You can use some third-party component libraries or create your own components. The following code has a very basic scrolling example:

import flash.display.MovieClip;
import flash.display.GradientType;
import flash.ui.MultitouchInputMode;
import flash.ui.Multitouch;
import flash.events.TouchEvent;
import flash.geom.Rectangle;

var mc:MovieClip = new MovieClip();
mc.graphics.beginFill(0xFF0000);
mc.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight * 2);
mc.graphics.endFill();
mc.graphics.beginFill(0x0000FF);
mc.graphics.drawCircle(stage.stageWidth/2, stage.stageHeight, 50);
mc.graphics.endFill();

this.addChild(mc);

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

mc.addEventListener(TouchEvent.TOUCH_BEGIN, touchBegin);
mc.addEventListener(TouchEvent.TOUCH_END, touchEnd);

function touchBegin(e:TouchEvent):void {
    mc.startTouchDrag(e.touchPointID, false, new Rectangle(0, - stage.stageHeight, 0, stage.stageHeight * 2));
}

function touchEnd(e:TouchEvent):void {
    mc.stopTouchDrag(e.touchPointID);
}

There are other tutorials on the internet for you to scroll objects. A good library for you to spice up with smoothing effects is Greensock .

Scroll to Top
AllEscort