flash probs.
- Started
- Last post
- 28 Responses
- method_c
I have this site with 2 flash movies 1 for the audio and 1 for the menu:
http://www.leox.com/sneak/ojav2/…
This is the audio player embedded with javascript:
http://www.leox.com/sneak/ojav2/…As u can see it works, but it doesn't work in the page. For the code i used this :
http://www.leox.com/sneak/ojav2/…How can it be that it doesnt work in the main page ?
With the menu i have the following prob:
I have this code on the contact button:
}
onClipEvent (mouseDown) {
getURL("pages/contact.html", "content");}
This works, but it works for all the buttons :-s how can i specify in the onclipevent that it should only work for this button. Can i use the instance name in the code or something ?
thanks
- skt0
myButton.onRelease = function () {
getURL("pages/contact.html", "content");
};
- method_c0
yeah but is a MC, not a button.
- method_c0
is it not possible to use mc's for menu buttons to control html ?
- joyride0
be sure to give your mc an instance name of myButton and it will work fine. the key is to have the object the same name as the code that's calling said object
make sense?
- skt0
um ok, then...
myMC.onRelease = function () {
getURL("pages/contac t.html", "content");
};
- joyride0
lol skt... I almost said the same thing. but button or mc, don't make any difference. As long as you can name it, it will work
- UndoUndo0
what skt means is you can treat an MC as a button when it comes to clicking
- method_c0
thanks guys
- method_c0
hmm that aint working, i can't use onRelease on a MC .. or can i ? : (Statement must appear within on/onClipEvent handler)
and when i just put the instance name in front of it like this :
contactBut.onClipEvent (mouseDown) {
getURL("pages/contact.html", "content");
}i get:
**Error** Scene=Scene 1, layer=buttons, frame=1:Line 12: Expected a field name after '.' operator.
contactBut.onClipEvent (mouseDown) {
- joyride0
Click on the contactBut (mc)
In the properties panel, make sure it is named contactBut
now make sure you have nothing selected on the stage.
select the layer in the timeline you want the AS to be:
add the code here:
contactBut.onRelease = function () {
getURL("pages/contac t.html", "content");
};I think your trying to put the code on the button or mc itself... *SMACK* don't do that! instead name the object (button or mc) and refer to that object in the code. It's better programming practice.
Got it?
- method_c0
thanks ! i got it :)
i have some more code on all the buttons to create to easing effect :
onClipEvent (load) {
scale = 0;
}
onClipEvent (enterFrame) {
if (scale == 1) {
_y = _y + (150 - _y)/3;
}
if (scale == 0) {
_y = _y + (105 - _y)/5;
}
}this code doesn't work anymore if i have the onrelease function in the timeline. So i guess this code also has to be in the timeline. Can i have it once for all the buttons? how does it have to look?
- skt0
Buy a book. Or follow some online tutorials. There is no point in us just writing your code for you. You won't learn anything that way.
- joyride0
you can place all the code you want for that button or mc after the getURL call.
The onClipEvent cant go in, but the scale = 0 and _y = ... can.
Play around, look at kirupa.com for examples... learn. we've all done it.
gL
- method_c0
dudes, thanks
i can't use the onClipEvent, i can't use onRollover cause its not a button. please point me in the right direction.. what should i use, cant seem to find it :(
- skt0
You can use onRollover on any MC. Just make sure you name it. MC's can do anything Buttons can do and more.
- UndoUndo0
^^ listen to skt
- joyride0
^^^listen to undo listening to skt
for all the thing you can do via AS.
Type this out in the AS pane. Type it do not copy/paste or it won't workcontactBtn_mc.
The _mc or _btn will bring up a list of all the functions available. then use help to see how they work
- method_c0
Well, i now have this (and it doesn't give any errors!) .. but it doesn't work either any idea why ?
the contact.html link DOES still work but the scaling does not
contactBut.onLoad = function() {
scale = 0;
}contactBut.onRollOver = function() {
if (scale == 1) {
_y = _y + (150 - _y)/3;
}
if (scale == 0) {
_y = _y + (105 - _y)/5;
}
}contactBut.onRelease = function () {
getURL("pages/contact.html", "content");
}
- UndoUndo0
method what are you scaling? the button?
- method_c0
thats pretty helpfull joyride2 :)