This content has been marked as final.
Show 13 replies
-
1. Re: Cursor and Button Assistance
Newsgroup_User Mar 31, 2009 5:31 AM (in response to Tatious)>>Now this works ALMOST perfectly, the cursor moves, I can click with it....
However, my custom cursor is out of synch positionally from where it should
be,
it rests just below where it should be, by maybe an inch on my screen. What
would have caused this (please remember I am a beginner) and what could I do
to
correct??
Edit the clip and move the graphic so that the spot you want to point/click
with is at the clips 0,0 registration point.
2. I suggest looking up, and using, the MovieClipLoader class and not bother
with anything else. There's a good example in the onLoadInit method
description that shows how to load a jpg into a clip. It's no different to
load a .swf.
--
Dave -
www.offroadfire.com
Adobe Community Expert
http://www.adobe.com/communities/experts/
-
2. Re: Cursor and Button Assistance
Ned Murphy Mar 31, 2009 5:34 AM (in response to Tatious)1. Make sure your cursor is centered in its own stage
2. If your instructor is teaching you to put code on objects... tsk, tsk...
Anytime you attach code to an object it requires some form of an on handler to make it work...
on(release){
loadMovieNum("custom.swf", 0);
}
The better alternative is to have this code in the timeline where the button is placed (in an actions layer, not the button's layer)...
btnName.onRelease = function(){
loadMovieNum("custom.swf", 0);
} -
3. Re: Cursor and Button Assistance
Tatious Mar 31, 2009 8:59 AM (in response to Tatious)Hey, thanks alot guys
My first quesiton has been answered, all sorted now and perfect...
My second one however I am still having trouble with
DMennenoh - I looked in to the moviecliploader idea but i couldnt get it to work, I was getting errors when I checked the code.
NedWebs - Your code technically seemed to work, in that when I checked the code for errors there were non, but when I export the movies (something i was told by my lecturer i would have to do in order to check the link is working) the button doesnt work, i clock on it and nothing happens. -
4. Re: Cursor and Button Assistance
Ned Murphy Mar 31, 2009 10:34 AM (in response to Tatious)The code is correct, so there has to be something else. Does the custom.swf file exist in the same folder as the file you're testing?
Which version of the code are you trying? If it's the second, you have to give your button an instance name and use that... my example used "btnName", but it can be whatever you name it. -
5. Re: Cursor and Button Assistance
Tatious Mar 31, 2009 11:39 AM (in response to Tatious)I've tried both of the options you gave me.
The the filename of the file is movie2.swf and the instance name of the button is gomovie2. All of my .swf files are located in the same folder as each other, as well as the .fla files.
For the first option I selected the button and pressed F9 and gave it the code -
on(release){
loadMovieNum("movie2.swf", 0);
}
and when that produced the results I explained in my earlier post I tried -
on(release){
loadMovieNum("C:\Users\Simon\Desktop\flashsite\movie2.swf", 0);
}
Which did the same.
For the second option I created a new layer and inserted a keyframe on the same frame number as my button, F9'd and inserted this code
gomovie2.onRelease = function(){
loadMovieNum("movie2.swf", 0);
}
And got the same results, then I tried again with the whole folder address and nothing was different. -
6. Re: Cursor and Button Assistance
Ned Murphy Mar 31, 2009 11:58 AM (in response to Tatious)Are you sure that's the instance name and not the name you assigned it in the library?
Try putting a trace inside the button function to see if it's ever getting in there...
trace("in the button function"); -
7. Re: Cursor and Button Assistance
Tatious Apr 1, 2009 2:59 AM (in response to Tatious)Its definitely the instance name of the button that Ive changed, how do I put the trace in? Thanks for your help so far btw, much appreciated -
8. Re: Cursor and Button Assistance
Tatious Apr 3, 2009 5:16 AM (in response to Tatious)Just bumping this in the hope of still getting help -
9. Cursor and Button Assistance
Ned Murphy Apr 3, 2009 9:02 AM (in response to Tatious)You type it in, like any other code.
The help docs are very useful things to become familiar with. They would have answered that question for you. -
10. Re: Cursor and Button Assistance
Tatious Apr 3, 2009 10:46 AM (in response to Tatious)Thanks for the reply, apologies for being really slow on knowing what to do, but as I said, I'm a real flash newbie (been using flash for only... 2 months or so)
I'm gonna start using the flash help files as much as poss, but I'm confused about about a few things,
1. Can this trace be used in either of the coding situations you mentioned earlier (where I either use a separate actions layer, or I code the button itself)
2. I am confused as to what I put inside the trace () brackets, as the example they use in the help file just makes absolutely no sense to me...
3. If 1. Is correct would the code (for example if I use a separate layer) be
gomovie2.onRelease = function(){
loadMovieNum("movie2.swf", 0);
};
trace("");
With whatever I have to put inside the brackets
-
11. Cursor and Button Assistance
Ned Murphy Apr 3, 2009 11:52 AM (in response to Tatious)trace() is a very valuable tool to get an understanding of, and it is quite simple to understand. What it does is output whatever you ask it to, and it outputs it to the Output panel.
So you can use it to check what a value is equal to at a certain point during processing. This can be very helpful when something is coming up 'undefined' in an error message. Unfortunately, Flash isn't very good about telling you what it found that is undefined in such circumstances (kinda awkward since it knew enough to tell you about it... it should be able to explicitly identify what item it is). So you sometimes have to fish with different variables to see which isn't what you thought it would be. So if you had a variable named "myVar", you would trace its value using: trace(myVar);
You can also use it to simply let you know if something made it to a certain point in your processing, such as I suggested in your case. I usually just use trace("here"); If it makes it that far into the processing the output panel will display "here" (no quotes). Then you can keep moving it until it no longer appears... that usually points to a problem in whatever line of code preceded it.
So, specific to your situation...
gomovie2.onRelease = function(){
trace("here");
loadMovieNum("movie2.swf", 0);
};
... will tell you if it made it into the button's onRelease function. -
12. Re: Cursor and Button Assistance
Tatious Apr 3, 2009 12:07 PM (in response to Tatious)Thanks :)
I have done the trace, as you instructed (on the actions layer, keyframe located above my button) with that code and nothing came up in the output panel. -
13. Re: Cursor and Button Assistance
Tatious Apr 3, 2009 1:34 PM (in response to Tatious)I have uploaded a .fla file if you are interested in looking at that
http://www.megaupload.com/?d=3WOTS50W
On this .fla the button is located on frame 88/ layer 64. With the actionscript located on the layer above. The button will be navigating to "movie3.swf"