0
想要在用户滚动到Flash AS3中动态文本框的底部之后执行动画。文本是动态加载的,如果有的话。动态滚动文本到底时可以调用Flash(AS3)函数吗?
想要在用户滚动到Flash AS3中动态文本框的底部之后执行动画。文本是动态加载的,如果有的话。动态滚动文本到底时可以调用Flash(AS3)函数吗?
像这样的东西应该做的伎俩:
myTextField.addEventListener(Event.SCROLL, scrollHandler);
function scrollHandler(e:Event):void {
if (myTextField.scrollV >= myTextField.maxScrollV) {
trace("You've Reached The End - It happens to us all eventually");
//do your animation
}
}
我搜索,在我的项目最后部署。这是工作代码。非常感谢你为我提供大部分解决方案。
private var mcScrolll:mcScroll;
private var mcBolgee:mcBolge;
private function Scroll_Method_New():void
{
tempBGBmp = new TempBG();
this.addChild(tempBGBmp);
tempBGBmp.x = 0;
tempBGBmp.y = 0;
if (!trainer_Maria_text)
trainer_Maria_text = new TextField();
createTextWithXY(trainer_Maria_text, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas at augue vitae est bibendum egestas. Fusce molestie felis nec arcu tincidunt dictum. Morbi dapibus vitae tortor non fringilla. Proin consectetur sapien ut eleifend ullamcorper. Duis blandit laoreet hendrerit. Duis sit amet massa sit amet tortor consequat dignissim sed vitae nisl. Vivamus vel lobortis odio. Sed id posuere dolor, eget auctor est. Donec sapien libero, bibendum ac .", 0, 0, 400, 41);
//trainer_Maria_text.scrollRect = view;
//tempBGBmp.bar
//trainer_Maria_text.scrollRect.x = 50;
//trainer_Maria_text.scrollRect.y = 50;
//trainer_Maria_text.scrollV = 1;
/*mcScrollZone = new mcScrollZonecopy();
this.addChild(mcScrollZone);
mcScrollZone.x = 0;
mcScrollZone.y = 0;*/
mcScrolll = new mcScroll();
this.addChild(mcScrolll);
mcScrolll.x = 600;
mcScrolll.y = 50;
mcBolgee = new mcBolge();
this.addChild(mcBolgee);
mcBolgee.x = 600;
mcBolgee.y = 50;
var rect:Rectangle = new Rectangle(mcBolgee.x, mcBolgee.y, 0, mcBolgee.height - 90);
//MouseWheelTrap.setup(stage);
mcScrolll.addEventListener(MouseEvent.MOUSE_DOWN, StartDrag);
//mcScrolll.addEventListener(MouseEvent.MOUSE_, StartDrag);
mcScrolll.buttonMode = true;
stage.addEventListener(MouseEvent.MOUSE_UP, StopStageDrag);
stage.addEventListener(MouseEvent.MOUSE_MOVE, ScrollBody);
//mcScrollZone.mcText.addEventListener(Event.CHANGE, SetScroll);
//tempBGBmp.addEventListener(Event.CHANGE, SetScroll);
/*function SetScroll(event:Event):void
{
mcScrolll.y = 295;
//mcScrollZone.y = -(((mcScrolll.y - mcBolgee.y)*((mcScrollZone.height /*- mcMask.height*/)/(295 - mcBolgee.y)))) + mcBolgee.y;
tempBGBmp.y = -(((mcScrolll.y - mcBolgee.y)*((tempBGBmp.height /*- mcMask.height*/)/(295 - mcBolgee.y)))) + mcBolgee.y;
trainer_Maria_text.y = -(((mcScrolll.y - mcBolgee.y)*((trainer_Maria_text.height /*- mcMask.height*/)/(295 - mcBolgee.y)))) + mcBolgee.y;
}*/
var control:Boolean = false;
function StopStageDrag(event:MouseEvent):void
{
if(control)
{
mcScrolll.gotoAndStop(1);
control = false;
mcScrolll.stopDrag();
}
}
function StartDrag(event:MouseEvent):void
{
event.currentTarget.gotoAndStop(2);
control = true;
event.currentTarget.startDrag(false,rect);
}
function ScrollBody(event:MouseEvent):void
{
//mcScrollZone.mcText.autoSize = TextFieldAutoSize.CENTER;
if(control)
{
//mcScrollZone.y = -(((mcScrolll.y - mcBolgee.y)*((mcScrollZone.height /*- mcMask.height*/)/(296 - mcBolgee.y)))) + mcBolgee.y;
tempBGBmp.y = -(((mcScrolll.y - mcBolgee.y)*((tempBGBmp.height /*- mcMask.height*/)/(296 - mcBolgee.y)))) + mcBolgee.y;
trainer_Maria_text.y = -(((mcScrolll.y - mcBolgee.y)*((trainer_Maria_text.height /*- mcMask.height*/)/(296 - mcBolgee.y)))) + mcBolgee.y;
}
}
您是否找到解决方案?如果是这样,请接受答案或添加自己的答案(如果答案不合适),如果不是,请更新问题以显示您的进度。 – BadFeelingAboutThis 2014-12-05 19:17:25