Jump to content

actioncript problem

remyseroos
Go to solution Solved by GoodBytes,

You want a setup a Remote Assistance? PM me.

Hi,

 

I have a problem. I need to make a school assignment, about how to build a PC step-by-step. For that I need to make a website (already done) and a "virtual pc". So I already discovered that I need flash and actionscript for it, but I have 0 experience with both.

 

I have to less time to learn it properly, and the teachers can't help because we have a week off. So I need to have a quick tut or somthing to make the following:

 

I need to make a picture of the inside of the pc case, then I need to add buttons on the different HW components and if you click on them, it needs to open a pop-up, in witch I can write detailed about that component.

 

I hope someone has a good idea. 

Link to comment
Share on other sites

Link to post
Share on other sites

ActionScript 2.0 has the same coding style as C/C++/Java/JavaScript... It's very close to Java-Script.

And it is a bit like HTML like where you can go:

var myVar:String = "2"

var result:Number = myVar - 1;

and it will work, you'll get 1. It's not suppose to work, but the compiler goes "Oh that;s what you meant", and corrects your code during compilation. While this is fun. This can lead to big issues due to miss interpretation of what you are trying to do by the compiler, so I don't recommend to do it, and be careful.

I'll go with AS2 as I know it, and don't know or really care about AS3.0, as Flash is pretty much dead. I prefer to learn better languages, such as C#, and improve my C++ knowledge.

Give me a moment, and I'll get back to you, with the code you need.

Link to comment
Share on other sites

Link to post
Share on other sites

So what you want to do is very simple.

1- Stage 1, Frame 1, Layer 1, click on the frame, and open the Action panel (F9)

// Tell Flash that the project is non scalable, and align at the top left corner of the screen.// You need this, to not have your project scale as you scale it, and everything gets blurry, and ugly.Stage.align = "TL";Stage.scaleMode = "noScale";stop(); // Don't play the project like a movie. Stop at Frame 1. We are doing a program, not a movie.
2- Create a MovieClip, name it "Motherboard Layout". To do this, open the Library panel if it's not open (Windows > Library), then on the Library panel, click on the icon at the bottom of the panel, that looks like a folder with a plus sign on it.

3- When done, double click on the MovieClip just added on the library. This will allow you to edit it. Inside, on frame 1, enter the code:

stop();
This will make it no play each frame.

4- File > Import > Select an motherboard picture.

5- If you want to add different motherboard layouts, select the frame, and hit F6.

Then import like in 5, another motherboard image.

6- Back on our Mr. Library, and click on the Folder with the plus button, to add something new. This time, a Button. Give it name like: Component Highlight Button

7- Once done, double click on it to edit it. Now. you'll see 4 frames. Up, Over, Down, Hit.

Up is what do you want (you draw like in Paint) the button to look like when the mouse is not over the item. It can be blank.

Over What the button will look like when the mouse is over the button. It can be blank.

Down What the button will look like when the mouse is pressing on the button. It can be blank.

Hit Not visible frame. This indicates the area/zone where you want the mouse react with the button. Usually, you make a black or white square of the size of the button.

8- Now double click on "Motherboard Layout", to edit that, and position your button, by dragging it to the motherboard, and position it. You can add multiple of them.

9- Click on a button that you added, on the properties give it a unique name, without any spaces. You'll need this to to identify it, with your code. Do the same for each button.

10- Click on the button, and hit F9, to show the action panel, and enter:

on (release) {   _level0.callbackFunction(this);}
Do the same for every button.

11- Click on "Stage 1" to return on the Stage, out of the Movie Clip.

12- Drag and drop "Motherboard Layout" from the Library, to the Stage, and position it where you want.

13- To make the stage bigger or smaller, click on the stage, and click on the Properties panel, the dimension, and you can enter larger or smaller dimensions

14- Click on the Movie clip you just put on the stage, and on the Properties panel, enter as name: motherboard_MC

This is the name of the MovieClip (Object), to refer it in your code.

15- On the stage, click on the Frame 1, and open the action panel, and add to what you have:

function callbackFunction(var obj:Object) {     if(obj == _level0.motherboard_MC.<button name that you entered without the '<>'>) {        // Code with the action to take for when the button is pressed.        // You can make a new Movie Clip, called "Panel", where you draw a panel, with a text box, set as Dynamic in it's         // properties with the name: description. Position that panel on the stage and call it, "panel", and do at this stop of the         // code:        // panel._visible = true;        // panel.description.htmlText = "Hello!<br>This is a description of the <b>component</b>".        // And then add above this function (callbackFunction), panel._visible = false;        // Be sure to have a button on the panel, where you can call: Close, where as function on the button, you do        // on (release) {        //     this._visisble = false        // }     } else if (obj == _level0.motherboard_MC.<another button>) {        // etc..     }}
You are done. To compile it, to Ctrl+Enter on the keyboard.
Link to comment
Share on other sites

Link to post
Share on other sites

Thanks for the help !

After a day of hard working i'm a bit tired, so i go and take a sleep. Tomorrow i'll go check it out and do it.

 

Again thanks, you're my hero !! 

Link to comment
Share on other sites

Link to post
Share on other sites

I'm getting a bit depressed here.

 

I have been trying the whole day, but i can't get it done. I get errors all over the place, one moment I have my actions, and a few secs later there gone.... then my buttons are just on other places then where I putted them  :wacko:

 

I just think actionscript doesn't likes  me :P

 

I also borrowed the "classroom in a book" book, but that's just really to much t learn in this time period.

Is there maybe a other (easier) way to do this ? 

 

BTW: i have some skills in HTML & CSS, isn't it possible to do this in HTML with some jquery ??

Link to comment
Share on other sites

Link to post
Share on other sites

You can do everything in JavaScript if you so desire.

 

Can you send me what you have done? Please save your .fla file for Flash CS3, if you can. I don't have (or can afford) a newer Flash version (File > Save As).

If that is not possible, then I am sure you have your Flash project set for ActionScript 3, and not 2. (File > Publish Settings > Flash tab > Select: ActionScript 2.0)

Link to comment
Share on other sites

Link to post
Share on other sites

I have flash CS6, so i can save it on the lowest version (CS5). Can you do something with that ?

 

Also I'm sure it set my document for AS2.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×