Moving Frames in the Main Timeline from Inside a Movie Clip - actionscript-2

I've got an animation inside 1 frame of my main timeline (the animation is inside a movie clip). Once this animation is done, I want flash to move to the next frame of the main timeline, and stop.
What code do I use here? I can't figure it out.

The correct code ended up being
_root.gotoAndPlay(3);

Related

GSAP slider, destroy timeline on resize and reinitialize

http://codepen.io/TPDBrendan/pen/xgwWwM
I'm trying to get a full page clip style slider set up to handle resize, but I seem to be going in circles at this point despite trying a bunch of suggestions on this topic from the forum.
I've already accomplished the basic effect - screen split in half vertically, each side has a timeline that is wiping towards the center revealing the slide below, which is simultaneously sliding towards center. Right side is on a slight delay intentionally. If you load the codepen and don't resize, you'll see what I mean.
Window resizing is throwing me a curveball, though. I've set up debounced functions to kill the 2 current timelines and then rebuild them again with new resized viewport dimensions. It's getting the new window dimensions and setting up a new timeline with these specs succesfully, but resizing several times reveals that it must not be killing the old timelines and is just creating multiple copies at each viewport size.
I'd like to be able to save the progress of the current timeline before destroying it and then initialize the new, resized timeline to this progress point so that to the user it just looks like one animation that pauses slightly on resize. Would also be great if, once the animation completes, window resize will not be able to initialize another timeline, so it can rest on the final slide. But, for now, just figuring out how to solve the current duplicate timelines issue would be awesome!
These are functions I'm using on resize, but kill doesn't seem to do anything.
function resizeLead(){
prog1 = tl.progress(),
prog2 = tl2.progress();
tl.seek(0).kill();
tl2.seek(0).kill();
}
function resizeTrail(){
windowSize[0] = $(window).width();
windowSize[1] = $(window).height();
buildTL();
}

Scrolling Scene in cocos2d

I have a sprite which moves across the screen.so i want to switch between the scenes.how can i do that.i am not interested in using Tile Map.I want just like angry birds scene scrolling.
Any Idea,
Thanks
If i understand what your asking you could just add everything to a cclayer and have everything as a child of it and move the full layer left or right to scroll
As glogic says, create a CCLayer and then add a CCSprite to it with an image much larger than the screen size.
Now in your touch handling code, do something like this...
OnTouchBegin - store position of the touch
OnTouchMoved - calculate distance from stored position where touch started and move the whole layer by that much.
OnTouchEnd - If your sprite has move too far and you have gone off the edge of the sprite, slide it back to the edge

Slider set to continuous seems to block main thread

I'm using a slider to resize some thumbnails in an app. I've set the slider to continuous so it updates as you move the slider instead of when you finish moving it. Works great, except for one thing:
The view that contains the thumbnails the slider resizes in in a split view. When the user starts sliding, i want to maximize said splitview for better usability. The only issue is, while the slider is being moved, it appears to be blocking any resizing operations of the UI. Anyone know how I can un-block it?
Or perhaps know of a different approach?
I figured it out!
Dragging the slider changes the run loop mode. I was maximizing my split view using an animation which has an NSTimer as it's backbone. I was adding the timer to the default run loop mode, when i should have been doing this:
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];

object position relative to a different subview

I am thinking about creating a Game Board view with an array of subviews to form slots for tiles. I plan to have tiles that I can drop onto the board and have them snap into position. The part I am unclear about is when I drop my tile and the touchesEnded event fires, what is the best way to loop through the subviews of my Game Board to see which slot I am over so I can have the tile snap into proper position? Or is there a better way to keep track of all the "slot" positions?
I really don't want to have to hardcode every cell position and then keep track of it if the Game Board ever gets shifted in my view controller.
Check out hitTest:withEvent: and pointInside:withEvent:.
ditto imaginaryboy. you don't need to loop through anything. let UIKit do the heavy work for you. Compute the center point of the piece that was dropped on your board and the use hitTest:withEvent: on the view containing your board.

Animate the drawing of a line (Quartz 2D?)

How would you go about animating the drawing of a line in a UIView on the iPhone? Is this possible? It can be drawn but can it easily be animated so it appears to be hand drawn?
There's no built-in way to do this no. You'd have to redraw the line repeatedly, interpolating between the start and end points using a timer callback to invalidate the view and trigger a redraw. Of course the redraw would have to draw everything in the area of the view bring redrawn which is potentially slow.
What I would do if I had a series of lines I wanted to draw over a period of time is to have two subviews - they would cover the same area and the top one would have a transparent background. Have the top one draw just the line that I am currently animating and when it's finished, draw the full length of it in the lower view. Then repeat, animating the next line in the top view.
With the new API you can do that easily, using strokeEnd property of CGPath.
You can read more details here: What's the easiest way to animate a line?