-
linkage?
if i place a button on my main timeline called "p1", and there is a mc called "clip1" with code on frame 1 that does a function when "p1" is pushed... what would the coding for it look like this to have the function happen? it does not seem to work no matter what i do... but if i put it within the mc and remove the _root it works fine. how can i have the button on the main timeline or rather "call it"
i used this
_root.p1.onRelease = function() {
Last edited by ultrapyro; 04-25-2008 at 11:31 AM.
-
http://www.in3d.eu
Hi,
If both are in the main timeline (_root) (or in the same location -mean have the same parent-) then it should work..
For example Insert this AS in frame 1 of your _root timeline:
Code:
p1.onRelease=function() {
clip1._alpha=50
}
Of course you have to name your button and clip accordingly (select an object and in the "Properties" tab inside Flash environment give the appropriate names eg. p1 for the button and clip1 for your movie clip)
Kostas
-
kk thanks, but how about if the button is else where such as the main timeline, and the mc code is not on the timeline... but within the mc (which is on the main timeline)
-
http://www.in3d.eu
Just give the appropriate target path..
Example:
If "clip1" is inside a clip named "Container" (and "Container" is inside _root)
then use:
Code:
p1.onRelease=function() {
Container.clip1._alpha=50
}
If "clip1" is inside a movie clip named "clip2" which is inside "Container" then use:
Code:
p1.onRelease=function() {
Container.clip2.clip1._alpha=50 //To access clip1
Container.clip2._rotation=45 // To acess clip2
}
Of course you can have any clip path combination. Depends where are you:
For example to access the "Container" clip from inside "clip1" in the previous example, may use:
_parent._parent._rotation=30 // Acess "Container" clip from its child "clip1"
Or the same is: _root.Container._rotation=30
There is a parent-child relationschip (a clip inside another, is a child of this clip). When change a property in the parent, affects its children too..
Also used the keyword "this" to refer the current object
_level0 is synonym as _root etc..
You can even communicate between movie clips from different levels
like: _level1.Clip1._xscale=50 (you don't need the _level1 if you are inside _level1 -only if you access it from different levels)
Maybe sounds a bit complicated but need to always have in mind where are you (in which hierarchy level or path and what you want to access) Then you have to supply the correct target path..
If you become familiar with the basic idea then you see that is not so difficult.. hope
Last edited by Kostas Zotos; 04-25-2008 at 01:51 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|