Hello,
How can I initiate the CLICK of a button when the flash movie start at the beginning?
My codes are below:
function moveBall(evt:Event):void {
stage.addEventListener(Event.ENTER_FRAME, moveBall);
stage.frameRate = 15;
if (football_mc.x < 512) {
ball_mc.x += 1;
} else {
ball_mc.x = -10;
}
}
//I do not want to use this two lines again.
//stage.addEventListener(Event.ENTER_FRAME, moveBall);
//stage.frameRate = 15;
//I also tried to call moveBall();
//But it can’t. An error appear.
//moveBall();
function stopBall(eve:Event):void {
stage.removeEventListener(Event.ENTER_FRAME, moveBall);
}
stop_btn.addEventListener(MouseEvent.CLICK, stopBall);
play_btn.addEventListener(MouseEvent.CLICK, moveBall);
I wish that the football will start moving when the movie open and start. The move and stop of the ball is controlled by the play_btn button and stop_btn button.
How can I initiate the CLICK of the play_btn button when the movie open?
Actually I also tried to call the moveBall(); function. However an error appear.
Thanks and best regards
Alex
try:
moveBall(null);
this way you send the parameter that the function needs to run
Hello,
moveBall(null);
It works 
However I really don’t know when parameter is required for a function? Why the ‘null’ parameter is used for the moveBall function in this case? I noticed that most function call do not require the parameter.
Thanks and best regards
Alex
hope not leading you in mistake, but what I know about functions that are driven by events, as the one you have (function moveBall(evt:Event):void) is that it will take an object as parameter (inside brackets (evt:Event)). In this particular case the object evt parameter returns a few mouse properties, this means that when you click on play button ( play_btn.addEventListener(MouseEvent.CLICK, moveBall); ) it will pass mouse properties to the function. You can get this more clear if, inside the function, trace the parameter evt, like so:
trace (evt);
just said what I learn by “trial and error”, maybe not wise words.
the wisest words come from the help, where you can see the object parameters:
public function MouseEvent(
type:String,
bubbles:Boolean = true,
cancelable:Boolean = false,
localX:Number,
localY:Number,
relatedObject:InteractiveObject = null,
ctrlKey:Boolean = false,
altKey:Boolean = false,
shiftKey:Boolean = false,
buttonDown:Boolean = false,
delta:int = 0
);
all of those properties are stored in the evt object, and in the case you don’t have the mouse click and instead call the function from the timeline you have to send the expected parameter, that said… you can send “null”

Hi pensamente,
Thanks for your explanation. I really learn a lot.
I visited your website:
http://www.pensamente.com/
The design is amazing. The photos you took are wonderful and abstract. You use the light source very well. Are you the guy with a guitar stand by the fountain in Valencia?
Thanks and best regards
Alex
:rambo:
i wish i could play guitar or something else, but lately i just play music in itunes or vlc… thanks a lot for the complement! 
that’s my really old piece of web, for a while that i don’t update it, to be honest for a while that i don’t photograph nothing at all. I’ve been more busy than ever, just moved to a barcelona (i’m from north of portugal), come with my girlfriend and know we are living here. I’ve also a blog but really not updated as well. there I used to post photos. About work this is my last portfolio site (my fist attempt to as3):
www.complexresponse.com
about the blog:
blog.pensamente.com
really glad you liked… i just my photos for my pleasure but can accept that others can see something on that. 
Do you work in webdesign as well?