Thursday, February 7, 2013

Endless Scrolling Background in Flash

CHEATS BY SUPER LEGENDS: Endless Scrolling Background in FlashCHEATS BY SUPER LEGENDS
HomePagesBlogLinkMore Shortcodes…PortfolioTwo Column PortfolioThree Column PortfolioGrid PortfolioLarge PortfolioContactFebruary 6, 2013Endless Scrolling Background in FlashPosted byPranav Madhani
Endless Scrolling Background

 

Tutorial GoalCreate an endless scrolling background using Flash Actionscript and one image. There are many applications for this technique such as your forum signature, website header, advertisement banners or even game backgrounds. This tutorial will create:Resources NeededOne seamless image. For the tutorial, right click and download the cloud image provided below:Seamless Cloud BackgroundStep 1 : Document SetupModify the Flash Document properties to:
Modify > DocumentDocument SettingsStep 2 : Import and Create Background ObjectImport the supplied cloud_bg.jpg onto the Stage.
File > Import > Import to Stage...Convert the image on Stage to a MovieClip with a Linkage Identifier.
Modify > Convert to Symbol
Name: bg_mc & Check 'Export for ActionScript'Convert to SymbolGiving the MovieClip a Linkage Identifier allows us to reference the MovieClip with Actionscript. You will see soon.Step 3 : Attaching MovieClips with ActionScriptDelete the MovieClip instance currently on Stage. The bg_mc MovieClip will still be in your Library.Select Frame 1 on the Timeline and open the ActionScript Window.
Window > ActionsEnter the following code:Code 0Line 1: Creates an empty MovieClip to hold 2 instances of bg_mc.
Line 2 & 3: Attaches 2 instances of bg_mc MovieClip into the 'animator' MovieClip.
Line 4 & 5: Offsets the position of bg_1 & bg_2. Below is a visual of what the current code will do when complied:DiagramSave and Test your current progress. You should see clouds.
Control > Test MovieIf you maximize the test movie, you will see that the clouds extend past the Stage on both sides.Step 4 : Animating the Cloud MovieClips with ActionScriptEnter the following code:Code 1Line 6: Initializes a "speed" variable to adjust scrolling speed.
Line 7: Initializes a "cloudWidth" variable equal to width of clound image.
Line 8: Attaches the onEnterFrame function to the animator MovieClip. It will execute once every frame or in this case 30 times per second.
Line 9 & 10: Shift both bg_mc's to the left. speed = 1, so they shift 1 pixel to the left every frame.
Line 11 & 12: Check if either bg_mc has shifted completely off stage. If yes, then move it to the right side of the Stage and it will look seamless.Concluding StatementsNow you have a endless scrolling background with variable speed. There are many ways to enhance the code, I kept it as simple as possible for the tutorial.Tutorial UpdateI received many requests on how to place content above the clouds. The problem explanation is below along with two methods to solve it:We attached the cloud MovieClips dynamically which means they are assigned a depth. All depths take precedence over layers on stage. So content that is on layers will always be beneath a MovieClip with a depth. Here are two ways to get content above the clouds.1. Put the Cloud ActionScript in a MovieClip
Create a new MovieClip, cut all the ActionScript from the main stage and paste it into the MovieClip. Go back to the main stage. Open the library and drag an instance of the Movieclip with the ActionScript on Stage. Now the dynamic clouds are inside a static Movieclip, which means you can now put things above it without using dynamic attachment.2. Attach Content Dynamically
Put the content in a MovieClip and attach it dynamically with a depth higher than 1.
example:
myStaticObject = attachMovie("staticObject","myStaticObject",2);0comments:


Newer PostOlder PostHomeSubscribe to:Post Comments (Atom) Like This ADD 2Total PageviewsSparklineADD1Popular Postsninja saga trainer v4.32ninja saga trainer v4.32no imageNEW NINJA SAGA TOKEN HACK (2012) MAY PERMANENT FOR FIDDLERNINJA SAGA V4.2 free downloadNINJA SAGA V4.2 free downloadNINJA SAGA GOD -MODE 4.8NINJA SAGA GOD -MODE 4.8Ninja Saga Pro Version 2.1Ninja Saga Pro Version 2.1NINJA SAGA TOKEN GENERATOR v2.1NINJA SAGA TOKEN GENERATOR v2.1no imageNINJA SAGA EMBLEM HACK PERMANENTno imageNEW NINJA SAGA TOKEN HACK FOR ANDROID (SAVE FILE)no imageNew ninja saga 2012 may TP hack 5000 by SUperlegends and DArk-LEagueno imageNINJA-SAGA 2012 SECRET SCROLL OF WISDOM HACKTRACKCopyright © 2012 CHEATS BY SUPER LEGENDS.Blogger Template by ClairvoAbout UscrawlerAmfibi Web Search & DirectorycounterWebsite counterGoogle+ Followers
View the original article here

No comments: