Langy
03-29-2006, 09:33 AM
Hello
I'm on my first Flash project where I want to create a partially interactive project. I can program in a few languages so just trying to get my head around Actionscript.
The initial part of the project all runs from frame 1 and this is what I want it to do.
The background image (Background_mc) is brought up from an alpha of 0 to 75.
Then the title text (Title_mc) and the backing for the text (TitleBack_mc) is also faded in.
After this the menu items (Gallery_mc) just one item so far is made visible.
I use the onRollOut and onRollOver to change the alpha values of the menu item.
If the user clicks on the menu item I then need to disable the actions of the mouse on this and then procede as below.
On clicking the menu item a backing (GalleryBack_mc) for the Gallery images is faded in and sized.
Included below is the code for my first project and I have a few questions as below.
1. When I fade in / size GalleryBack_mc its rather jerky, so I think I need to change the frame rate whilst this happens, which is the best way?
2. After the GalleryBack_mc has loaded I have 8 JPG files in the Library that I want to size and move around the screen on a timed basis. At the end of my code you can see that I am trying to use the createEmptyMovieClip and loadMovie but having little success. Is it possible to load a JPG from the library in to a new mc so that I do not have to create mc's for all the images? If so how?
3. The whole of frame 1 is now getting rather congested with these mc's and I want to display these via AS rather than placing instances on the stage so the also relates to the Q2 above. Can mc's also be hidden so that they do not interfere etc.
4. Hopefully the last question, if someone has a better suggestion about my code, especially the structure then all comments are welcome as I find the best way to learn is get on with it yourself and then ask someone who has good knowledge to advise on alternatives.
Many thanks in advance.
Langy
var Menu
// Load the first parts of the movie
Background_mc.onEnterFrame = function() {
// If start of movie then set all alpha to zero
if (this._alpha > 90) {
this._alpha=0;
Title_mc._alpha = 0;
TitleBack_mc._alpha = 0;
Gallery_mc._visible = 0;
}
// Increase the alpha on the background image
if (this._alpha < 75) {
this._alpha+=5;
} else {
// When background completed fade in the title
Title_mc.onEnterFrame = function () {
if (this._alpha < 100) {
this._alpha+=5;
if (TitleBack_mc._alpha<65) TitleBack_mc._alpha+=5;
} else {
// When title faded in show the menu items
Gallery_mc._visible = 1;
}
}
}
};
// Check for the mouse rolling over menu items
Gallery_mc.onRollOut = function () {Gallery_mc._alpha=50;}
Gallery_mc.onRollOver = function () {
if (Menu!=9) Gallery_mc._alpha=90;
}
Gallery_mc.onMouseDown = function () {
Menu=9;
GalleryBack_mc.onEnterFrame = function () {
if (this._alpha<60) this._alpha+=5;
if (this._width<425) this._width+=10;
if (this._height<425) this._height+=10;
var Test_mc:MovieClip = this.createEmptyMovieClip("Test_mc", this.getNextHighestDepth());
Test_mc.loadMovie("Club07-P01.JPG");
}
}
I'm on my first Flash project where I want to create a partially interactive project. I can program in a few languages so just trying to get my head around Actionscript.
The initial part of the project all runs from frame 1 and this is what I want it to do.
The background image (Background_mc) is brought up from an alpha of 0 to 75.
Then the title text (Title_mc) and the backing for the text (TitleBack_mc) is also faded in.
After this the menu items (Gallery_mc) just one item so far is made visible.
I use the onRollOut and onRollOver to change the alpha values of the menu item.
If the user clicks on the menu item I then need to disable the actions of the mouse on this and then procede as below.
On clicking the menu item a backing (GalleryBack_mc) for the Gallery images is faded in and sized.
Included below is the code for my first project and I have a few questions as below.
1. When I fade in / size GalleryBack_mc its rather jerky, so I think I need to change the frame rate whilst this happens, which is the best way?
2. After the GalleryBack_mc has loaded I have 8 JPG files in the Library that I want to size and move around the screen on a timed basis. At the end of my code you can see that I am trying to use the createEmptyMovieClip and loadMovie but having little success. Is it possible to load a JPG from the library in to a new mc so that I do not have to create mc's for all the images? If so how?
3. The whole of frame 1 is now getting rather congested with these mc's and I want to display these via AS rather than placing instances on the stage so the also relates to the Q2 above. Can mc's also be hidden so that they do not interfere etc.
4. Hopefully the last question, if someone has a better suggestion about my code, especially the structure then all comments are welcome as I find the best way to learn is get on with it yourself and then ask someone who has good knowledge to advise on alternatives.
Many thanks in advance.
Langy
var Menu
// Load the first parts of the movie
Background_mc.onEnterFrame = function() {
// If start of movie then set all alpha to zero
if (this._alpha > 90) {
this._alpha=0;
Title_mc._alpha = 0;
TitleBack_mc._alpha = 0;
Gallery_mc._visible = 0;
}
// Increase the alpha on the background image
if (this._alpha < 75) {
this._alpha+=5;
} else {
// When background completed fade in the title
Title_mc.onEnterFrame = function () {
if (this._alpha < 100) {
this._alpha+=5;
if (TitleBack_mc._alpha<65) TitleBack_mc._alpha+=5;
} else {
// When title faded in show the menu items
Gallery_mc._visible = 1;
}
}
}
};
// Check for the mouse rolling over menu items
Gallery_mc.onRollOut = function () {Gallery_mc._alpha=50;}
Gallery_mc.onRollOver = function () {
if (Menu!=9) Gallery_mc._alpha=90;
}
Gallery_mc.onMouseDown = function () {
Menu=9;
GalleryBack_mc.onEnterFrame = function () {
if (this._alpha<60) this._alpha+=5;
if (this._width<425) this._width+=10;
if (this._height<425) this._height+=10;
var Test_mc:MovieClip = this.createEmptyMovieClip("Test_mc", this.getNextHighestDepth());
Test_mc.loadMovie("Club07-P01.JPG");
}
}