English 中文(简体)
行动3
原标题:Actionscript 3 simple image slider

事先得到任何帮助。 我在行动文件3上说一句话,我想要做的是使形象变得更糟。 基本上,将有一个电影院,作为集装箱,一个左侧和右侧。 当我点击左顿时,集装箱滑坡留下,反之亦然。

现在,我这样做的事情是,当我说左顿时,问题就在于集装箱停下来,而且随着我点击左顿,移动时间会持续太久。 但是,我想在集装箱末停泊或停泊,我不敢肯定如何这样做。

我在网上搜索了所有这些内容,但并没有发现任何有用之处,我发现的大多数内容确实复杂或严重依赖外部图书馆,我不想仅仅复制和重复我不理解的密码。 任何人都希望对如何在行动说明中实现这一点给予仔细的见解。 3. 。

这里是我迄今为止法典的复印件。

Thanks -Noob

//leftButton and rightButton are movieClips on the stage
leftButton.addEventListener(MouseEvent.MOUSE_DOWN, moveLeft);
rightButton.addEventListener(MouseEvent.MOUSE_DOWN, moveRight);

//NOTE: thumbContainer is a movieClip on the stage
//Make the mask;
var myMask:MovieClip = new MovieClip();
this.addChild(myMask);
myMask.graphics.beginFill(0x000000);
myMask.graphics.drawRect(6,138,534,144);
myMask.graphics.endFill();
thumbContainer.mask = myMask;

//thumbContainer moves left on button press
function moveLeft(evt:Event):void
{
    thumbContainer.x -=  myMask.width;
}

//thumbContainer moves right on button press
function moveRight(evt:Event):void
{
    thumbContainer.x +=  myMask.width;
}
问题回答

Now I kind of got things working, the problem is when I press say the left button, the Container moves left,and keeps moving left as many times as I click the left button. But I want it to stop, or loop, at the end of the Container, and I m not quiet sure how to do this.

你在这里提到的情况并不明确。 根据我的理解,你有一个集装箱式我的马什克,在你的母集装箱下滑坡。 当你一再把左(或右) but子带上去时,集装箱就座。

假定这是问题,允许我马斯克集装箱离开或右边,但每次都用屏幕分辨率(如果说话或说什么的话)检查。 因此,只有在满足条件时,才离开/右边移动(是迁移离开/右边的空间)。

希望帮助!





相关问题
Flex: Text Input that accepts number only

Need a code that only accepts numbers. Upon inputting, the code must check if it is number, if not, it must remove the entered key or not enter it at all

How to dynamically generate variables in Action Script 2.0

I have a for loop in action script which I m trying to use to dynamically create variable. Example for( i = 0 ; i &lt 3 ; i++) { var MyVar+i = i; } after this for loop runs, i would like to ...

drag file(s) from destop directly to flash webpage

Could someone please let me know if is possible to drag (multiple) files from desktop directly into a flash webpage. If yes could you please link me to some online resources.

Can XMLSocket send more than once in a frame?

I have a XMLSocket and I call send twice in the same function. The first send works but the second does not? Does XMLSocket have a restriction to only send one message per frame? Do I have to queue ...

How do you stop a setInterval function?

I have a function that I want to run at an interval within a frame. I use the following code to start the function: var intervalID = setInterval(intervalFunction, 3000); Then, in a button s ...

What s a good way of deserializing data into mock objects?

I m writing a mock backend service for my flex application. Because I will likely need to add/edit/modify the mock data over time, I d prefer not to generate the data in code like this: var mockData =...

热门标签