|
|
|
#1 |
|
Junior Member
Join Date: Oct 2009
Posts: 10
|
AS2
In two movieclips how to call myfunction(parameter) so that the function loads only when it initializes like the onLoadInit method myfunction.onLoadInit = function(parameter) { trace("parameter==" + parameter); } I want to call a fucntion that does something like the above from the first mc while the function is declared in the second. |
|
|
|
|
|
#2 |
|
Super Moderator
Join Date: Aug 2000
Location: Montréal
Posts: 13,242
|
Since onLoadInit is an event of the MovieClipLoader Class, i gotta ask, in your example myfunction is your listener's name?
gparis
__________________
![]() AS 2.0 Forum Guidelines || Use PHP tags for code samples || Flash9 LiveDocs || AS 2.0 Language reference (CS4) |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Oct 2009
Posts: 10
|
Thank you really for the response!!
As i searched yes it has to be a listener but i can not make it work. See below. This is what works now: In the first movieclip==mc1 i have the PHP Code:
PHP Code:
1)to make another listener that will read the parameter 2)to use the same listener and read in there the parameter i don't know neither of both how to make them work... I tried to make a second listener like PHP Code:
PHP Code:
var myvar; or the last "php" code. Any ideas? Last edited by jonis56; 11-03-2009 at 12:34 AM. |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Oct 2009
Posts: 10
|
the problem is that i don't use the MovieClipLoader class in the second listener... so can i somehow have a function with a behavior like the onLoadInit that happens only one time?
how else to pass a variable in mc2 from mc1? |
|
|
|
|
|
#5 |
|
Super Moderator
Join Date: Aug 2000
Location: Montréal
Posts: 13,242
|
how else to pass a variable in mc2 from mc1?
mc1.somevar = mc2.someothervar; if the variable doesn't have a var prefix, ie: if its scope isn't restrained to the function's scope, there shouldn't be a problem. You could also in the 1st MCL's onLoadInit give the mc2 variable a value, or even set it there. That said, there cannot be an onLoadInit without a MCL, specially if you are not loading anything a second time around. So i suggest you follow the above solution. gparis
__________________
![]() AS 2.0 Forum Guidelines || Use PHP tags for code samples || Flash9 LiveDocs || AS 2.0 Language reference (CS4) |
|
|
|
|
|
#6 | |
|
Junior Member
Join Date: Oct 2009
Posts: 10
|
Quote:
|
|
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|