Flash Another Look 21-Nov-15 Computing Engineering and Technology [email protected] 1...
-
Upload
calvin-parker -
Category
Documents
-
view
214 -
download
1
Transcript of Flash Another Look 21-Nov-15 Computing Engineering and Technology [email protected] 1...
![Page 2: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/2.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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
![Page 3: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/3.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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
![Page 4: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/4.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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
![Page 5: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/5.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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
![Page 6: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/6.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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
![Page 7: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/7.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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.
![Page 8: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/8.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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
![Page 9: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/9.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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
![Page 10: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/10.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
10
Tricks & Traps• AS2 upwards is case sensitive
nCounter != ncounter != NCounter
• Note older code may not workstopAllSounds(); // worksstopallsounds(); // does not when using AS2 code
• Stricter data typing improves run-time performance
• AS 2 upwards has strict data typingvar nCounter:Number = 36The variable (nCounter) of type (Number) = 36
![Page 11: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/11.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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
![Page 12: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/12.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
12
Loop gotoAndPlay()• Buttons can be used to break the
loop
• Loop.htm
![Page 13: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/13.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
13
Key Class• Key press can also
be used…
• Key1.htm
![Page 14: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/14.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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);
}
}
![Page 15: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/15.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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.
![Page 16: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/16.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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
![Page 17: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/17.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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
![Page 18: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/18.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
18
Screen Plotting• Scroll.htm
• The scripting would go so…
var speed:Number = 10
onEnterFrame = function() {
if(Key.isDown(Key.RIGHT)) {
round._x += speed;
}
}
![Page 19: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/19.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
19
Screen Plotting• The project is built up in small sections each
overlaying the next to create the effect needed.
• Key X-Y.htm
![Page 20: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/20.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
20
var speed:Number =3onEnterFrame = 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;
}}
![Page 21: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/21.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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.
![Page 22: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/22.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
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.
![Page 23: Flash Another Look 21-Nov-15 Computing Engineering and Technology David.M.de-Leuw@staffs.ac.uk 1 Flash.](https://reader035.fdocuments.us/reader035/viewer/2022070404/56649f345503460f94c52001/html5/thumbnails/23.jpg)
Flash
Anoth
er
Look
Apr 20, 2023 Computing Engineering and Technology [email protected]
23
References
• ActionScript 2.0: A Real Programming Languagehttp://www.peachpit.com/articles/article.asp?p=102204
• Introducing ActionScript 2http://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 OOPhttp://www.kirupa.com/developer/oop2/AS2OOPindex.htm