android air flash,在Adobe Flash上​​触摸滚动Android上的Air

解决方案

1:尝试用以下替换Math.max(Math.min(maxY, _startY + offsetY), minY);:

clamp(mouseY - _startY + offsetY, minY, maxY);

function clamp(original:Number, low:Number, high:Number):Number {

return (original > high) ? high : (original < low) ? low : original;

}

2:将所有内容移动到一个容器中。移动一个对象比移动多个对象更容易。

多个对象:

0:MainTimeline

0:background_scroll_product //.y += offsetY;

1:davies //.y += offsetY;

2:toa //.y += offsetY;

...

一个对象:

0:MainTimeline

0:container //.y += offsetY;

0:background_scroll_product

1:davies

2:toa

...

示范

下面的代码,你可以拖放到一个新的项目,它将与编译工作滚动容器。请注意,其他人在问问题时可能需要这样的Minimal, Complete, and Verifiable example。

var background_scroll_product, davies, toa;

demoSetup();

/* ^^^ Omit this if you already have these objects defined ^^^ */

// Create a container for our content.

var container:Sprite = new Sprite();

addChild(container);

// Put the content inside the container.

container.addChild(background_scroll_product);

container.addChild(davies);

container.addChild(toa);

// setup the min based on the size of the contents.

var loc:Object = {

"max":50,

"min":stage.stageHeight - container.height

};

addEventListener("mouseDown", mouseHandler);

function mouseHandler(e:Event):void {

switch (e.type) {

case "mouseDown":

loc.start = mouseY;

loc.container = container.y;

addEventListener("mouseUp", mouseHandler);

addEventListener("mouseMove", mouseHandler);

break;

case "mouseUp":

removeEventListener("mouseUp", mouseHandler)

removeEventListener("mouseMove", mouseHandler);

break;

case "mouseMove":

// Scroll the container.

container.y = clamp(mouseY - loc.start + loc.container, loc.min, loc.max);

break;

}

}

function clamp(original:Number, low:Number, high:Number):Number {

return (original > high) ? high : (original < low) ? low : original;

}

function demoSetup():void {

// This sets up a facsimile of the project, to create a Minimal, and Verifiable example.

var bg:Sprite = new Sprite();

bg.graphics.beginFill(0xA1A1A1);

bg.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);

bg.graphics.endFill();

addChild(bg);

background_scroll_product = new Shape();

background_scroll_product.graphics.beginFill(0xf0e3e5);

background_scroll_product.graphics.drawRect(0, 0, 250, 750);

background_scroll_product.graphics.endFill();

davies = new Shape();

davies.graphics.beginFill(0x243066);

davies.graphics.drawRect(0, 0, 200, 400);

davies.graphics.endFill();

davies.x = davies.y = 25;

toa = new Shape();

toa.graphics.beginFill(0xdc3734);

toa.graphics.drawRect(0, 0, 200, 200);

toa.graphics.endFill();

toa.x = 25;

toa.y = 525;

}

响应FLA

我强烈建议你不要用工作场景,特别是因为他们创造肮脏的国家不是迫切辨认。事实上,由于您似乎正在努力实现移动应用,您绝对应该考虑使用完整的UI框架,如FeathersUI。不管...

挥之不去的集装箱

的Timeline试图把每一帧作为程序的唯一状态。您可以通过这种方式直观地构建用户界面,但它很笨拙。此外,正如您发现的那样,当您将WYSIWYG与功能性编程混合在一起时,Flash UI永远不会意识到并永远不会“清理”。您手动添加了addChild(container),因此您还需要手动添加removeChild(container)。你可以把它放在你的监听器函数里面,作为后退按钮。

集装箱悬停在标题栏

考虑你的主菜单heiarchy:

0: instance15 (Shape)

1: button_back (SimpleButton)

2: instance16 (StaticText)

3: container (Sprite)

正如你所看到的,层0通过2是你的顶部菜单的对象。在菜单后面移动container与调用addChildAt()一样简单,并将第二个参数设置为0索引。

addChildAt(container, 0);

最后图像被剪辑

这样做的原因是,你的内容不位于y:0。如果要解决这个问题,无论是在y:0移动到开始的内容,或加上抵消你的第一个图形的最小值的...

"min":this.loaderInfo.height - container.height - davies.y

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值