flash - parallax scrolling down with ActionScript 3.0 -
I want to make the road parallax scroll down with Flash in AS3, when I run the script, go up the parallax Used to be. And this is my code
package {import flash.display.MovieClip; Import flash.events.Event; Expansion of the public class kaleals movie clippings {
This is the variable I am creating
Public Priority Road: Road 1; Public Traffic 2: Road 1; Public Section Road Container: Movie Clip; Public Priority Road: Number; Public car car: car; Public Function Callus () {
And make this car, road and container
car = new car (); Road = new road 1 (); Road 2 = new road 1 (); Roadbreadth = 653.7; Car.y = 10.0; Car.x = 10; Road.y = 10.0; Road.x = 10; Road2.y = Road. Y + road breadth; Road2.x = road.x; // * Child Object Road Connector = New Movie Clip (); RoadContainer.addChild (road); RoadContainer.addChild (Road2); This.addChild (roadContainer); This.addEventListener (Event.ENTER_FRAME, onEnterFrame); Public Function Centerframe (Event: Event): Zero {car.y = car.y + 15; RoadContainer.y = 10 - car.y + 10; If (road. Y + roadbread + road container. ATTT 0) {road.y = road.y + (2 * road breadth); } If (road 2.y + roadbread + roadcontainer.ttt.t0) {road2.y = road2.y + (2 * roadbredth); }}}
I'm not going to go back to this Backgroung, please help me.
< Div class = "post-text" itemprop = "text">
Take a look at this sample, it's a very simple idea to wrap this object around, make sure your multiplier is the amount of roads you are wrapping Set to
if (road.y> 600) {road.y - = road.y * 2; } And {road.y ++; }
Comments
Post a Comment