Presentation is loading. Please wait.

Presentation is loading. Please wait.

Flash Another Look 21-Nov-15 Computing Engineering and Technology 1 Flash.

Similar presentations


Presentation on theme: "Flash Another Look 21-Nov-15 Computing Engineering and Technology 1 Flash."— Presentation transcript:

1 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash

2 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 2 Ch.Ch.Ch…Changes David Bowie “Only the wisest and stupidest of men never change.” – Confucius “Change is inevitable - except from a vending machine.” – Robert C. Gallagher “We cannot become what we need to be by remaining what we are.” – Max Depree “To change and to change for the better are two different things.” – German proverb

3 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 3 Why Scripting ? Import and export information, create forms, network communications programs Personalise the user’s experience Control movie clips and their properties more tightly

4 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 4 Why Scripting ? Build dynamic projects that vary according to information like weather data or the day of the week Dynamically control sound volume and stereo panning

5 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 5 ActionScript (AS 1) ActionScript 1 (Flash 1-5) Good for simple interactivity Basic “Glue” coding Plenty of code available but – code rough Limited capabilities led to some bad coding Non-Standard language – loosely related to JavaScript Was very slow Even sloppy code runs

6 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 6 ActionScript (AS 2) ActionScript 2 (Flash 2004 – 8) A proper OO language Good for more complex coding Deeper control of Flash capabilities More flexible programming environment Better de-bugging capabilities Cleaner coding – more readable (transferable.dir) Stricter syntax and error checking

7 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 7 ActionScript (AS 3) ActionScript 3 (CS3 – CS4) Full OO language Everything is now an object which can or has to be called up dynamically. Objects are embedded into objects as children ie:- the screen is an object which has active sprites within it as children. A child inherits attributes from the parent as well as controlling their own attributes.

8 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 8 Adaptability You can still program using ActionScript 1.0 in Flash MX 2004 and in Flash 8 Performance of AS1 is good in MX 2004 and Flash 8 ActionScript 2 code strongly resembles Java ActionScript 2 knowledge can easily be re-used in the industrial strength, cross-platform world of Java

9 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 9 Adaptability The code in Flash now runs a minimum of 5 times faster than AS 1 This opens Flash up to more potential uses especially the world of on-line and mobile games and communication using complex processing

10 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 10 Tricks & Traps AS2 upwards is case sensitive nCounter != ncounter != NCounter Note older code may not work stopAllSounds(); // works stopallsounds(); // does not when using AS2 code Stricter data typing improves run-time performance AS 2 upwards has strict data typing var nCounter:Number = 36 The variable (nCounter) of type (Number) = 36

11 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 11 Loop gotoAndPlay() Loops can be used to create a menu section where the film is waiting for a key or mouse event to happen

12 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 12 Loop gotoAndPlay() Buttons can be used to break the loop Loop.htm

13 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 13 Key Class Key press can also be used… Key1.htm

14 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 14 Key Class The script needs to account for the frame the video head is moving through. onEnterFrame = function() { if(Key.isDown(Key.UP)){ gotoAndPlay(1); }

15 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 15 Screen Plotting The screen is plotted from the top left hand corner of the user screen.._x is the horizontal plotting position._y is the vertical plotting position Objects can be placed on the desktop (off main screen) and called into position at will.

16 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 16 Screen Plotting The number relates to the position on screen relative to screen size Hence –._x =150 would be half way across a 300 pixel screen

17 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 17 Screen Plotting If you wanted an object to move onto and across the screen you would start it off in a -._x position then give it a variable speed. Round._x = -50

18 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 18 Screen Plotting Scroll.htm The scripting would go so… var speed:Number = 10 onEnterFrame = function() { if(Key.isDown(Key.RIGHT)) { round._x += speed; }

19 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 19 Screen Plotting The project is built up in small sections each overlaying the next to create the effect needed. Key X-Y.htm

20 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 20 var speed:Number =3 onEnterFrame = function() { if (Key.isDown(Key.RIGHT)){ round._x += speed; round._y += speed; } else if (Key.isDown(Key.LEFT)){ round._x -= speed; round._y -= speed; } else if (Key.isDown(Key.DOWN)){ round._y += speed; round._x -= speed; } else if (Key.isDown(Key.UP)){ round._y -= speed; round._x += speed; } else if(Key.isDown(65)) { round._x -= speed; } else if (Key.isDown(68)) { round._x += speed; }else if (Key.isDown(87)) { round._y -= speed; }else if (Key.isDown(83)) { round._y += speed; }

21 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 21 Interaction It is then possible to begin to create imagery to fit into the scene. Full.htm You begin to develop more involved interaction.

22 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 22 Conclusion Giving the user the ability to control items creates interactivity. Control of items is built up by creating small functions. Functions can work together to create sophisticated imagery and action.

23 Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 23 References ActionScript 2.0: A Real Programming Language http://www.peachpit.com/articles/article.asp?p=1022 04 http://www.peachpit.com/articles/article.asp?p=1022 04 Introducing ActionScript 2 http://www.macromedia.com/devnet/mx/flash/articles/ astfts_excerpt/astfts_lesson1.pdf, http://www.macromedia.com/devnet/flash/actionscript /actionscript.html http://www.macromedia.com/devnet/mx/flash/articles/ astfts_excerpt/astfts_lesson1.pdf http://www.macromedia.com/devnet/flash/actionscript /actionscript.html Kirupa ActionScript 2.0 OOP http://www.kirupa.com/developer/oop2/AS2OOPinde x.htm http://www.kirupa.com/developer/oop2/AS2OOPinde x.htm


Download ppt "Flash Another Look 21-Nov-15 Computing Engineering and Technology 1 Flash."

Similar presentations


Ads by Google