django
django

Reputation: 2909

Action Script 3 create ScrollPane componenet from class with touch support

REF: http://help.adobe.com/en_US/ActionScript/3.0_UsingComponentsAS3/WS5b3ccc516d4fbf351e63e3d118a9c65b32-7fa2.html

Following code is taken from above link. I have 2 questions.

  1. Following code requires ScrollPane componenet with name aSp placed on stage to work. How can i create this component from class/package so i can create this componenet from scratch without having it already on stage ? Just like we create movie clips from classes and it doesnt need to have one mvoie clip placed on stage ?
  2. Is there any class/package library already outthere which has scrollPane with touch support for andriod Publishing ? Or any help regarding touch support on scrollPane is welcome.
import fl.containers.ScrollPane; 
import fl.controls.ScrollPolicy; 
import fl.controls.DataGrid; 
import fl.data.DataProvider; 

var aSp:ScrollPane = new ScrollPane(); 
var aBox:MovieClip = new MovieClip(); 
drawBox(aBox, 0xFF0000);    //draw a red box 

aSp.source = aBox; 
aSp.setSize(150, 200); 
aSp.move(100, 100); 

addChild(aSp); 

function drawBox(box:MovieClip,color:uint):void { 
            box.graphics.beginFill(color, 1); 
            box.graphics.drawRect(0, 0, 150, 300); 
            box.graphics.endFill();         
}

Upvotes: 0

Views: 1996

Answers (2)

Rahul
Rahul

Reputation: 16

  1. You just have to drag the ScrollPane Component once on stage and then you can delete it from there. Then just add addChild for scrollpane in your above code and your scrollpane will be added.

  2. Can you just elaborate on what kind of touch support you need for scrollpane?

Upvotes: 0

pulterao
pulterao

Reputation: 160

I use this class for simple touch scrolling in my apps https://github.com/freshplanet/Air-Mobile-ScrollController. IF you need a more complex UI you can also take a look at the Mad components library https://code.google.com/p/mad-components/ which has touch support and is design for mobile.

Upvotes: 1

Related Questions