Groups | Blog | Home
all groups > flash actionscript > april 2004 >

flash actionscript : how do i get this in Action Script


robert5c
4/12/2004 9:19:42 PM
i don't know how to explain what i need...all i know is three of my buttons do
it right..the forth doesn't...and the only difference between them all is that
one has (in the movie explorer) "contact, <contact>" and the one that doesn't
work has just "Residential>....like i said i can't explain cause i'm not good
at explaining and i didn't start the script...i have a screen shot to show you
what it is and where...basicaly i want the two labels if you'd call them
that...to be the same...i want to define the other one too...[L=Picture Link
CLICK HERE]http://www.forecastheating.com/images/symbol.gif[/L]

it doesn't seem to just be a simple rename of the thing...i think its a symbol
name or symbol definition or somthing...cause also right clicking on the movie
clip symbol in my library and going to properties > advanced ... under source
under "Symbol Name:" it seem sto have the same exact name as aperars there in
the three that works except for in the forth it says "residential copy"....and
as you can see....the thing isn't showing up in a "<name>" format...its that
thing that i think is the only thing that is causing my problems cause its
making the line "_root.menu.residential._visible = true;" not actualy do
anything...any support is very helpful and i greatly aperciate it...i also
kinda need this soon please...thanks alot

Robert
sneakyimp
4/12/2004 9:37:23 PM
I think you need to give your button an instance name....i'm not certain but i
think that might be the issue. when you open the FLA file and you select each
of the buttons on your stage, you should look in the PROPERTIES pane. there is
a space for <instance name>. if this is blank for Residential, you need to
enter residential in there....i think.

not entirely sure.
robert5c
4/12/2004 11:46:11 PM
no its not that...all instance names are the same...here i posted all relavent
code...if someone can look at it and follow along and tell me where am i going
wrong...the code is the same for all four buttons...the only thing different is
like i stated...maybe following the code you guys can see whats going on and
tell me where i fell short...thanks [L=CLICK HERE FOR THE CODE
PICTURE]http://www.forecastheating.com/code.gif[/L]

...you may have to save it and use a photo program to zoom in and scroll...or
if your browser does auto image fit, press the button to see actual size
robert5c
4/13/2004 12:41:15 AM
if the code and all is not enough then let me explain to you what i am
doing..its a navagation...i have five buttons the be the main button (4 at the
time the code was shown)...that when press, run a little animation of a box
sliding over an area, then when the box reaches the set area, another movie
becoms visible...(the new movie is a movie with more buttons that fall under
the category)...the reason i did it for the other movie to be hidden at load,
and apear appon press is so that when the mouse is taken off the button...the
second menu doesn't go away...and therefore they can continue to use the new
buttons...if there is a better or other way of doing it...that would help
too...any help please thanks
sneakyimp
4/13/2004 1:42:34 AM
well, for starters, you're going to need to be more specific than just sending
the movie explorer. there's just not enough info there to solve your problem.

You have
1 - your main SWF,
2 your buttons that work and your buttons that do not
3 - the things that your button is supposed to control.

for your button to control other objects, those objects need an INSTANCE name
so that the button can 'locate' them. If your button is trying to control an
object that has no instance name, then your code is not going to work. if your
button launches a function that tries to control objects that have no instance
name, your code is not going to work. if your button tries to launch a
function that doesn't exist, your code is not going to work. if your code
tries to gotoAndPlay a frame that doesn't exist (and maybe the frame exists,
you just haven't given it a name properly), then your code is not going to work.

and when you say 'it doesn't work', is there any behavior at all? does it
partially work or does nothing happen at all?

i would recommend putting trace commands in your code. You can see them at
work if you open your movie and hit CTRL-ENTER.

like, try putting this in your actions for Residential-b:
on(release) {
trace('well, at least the button is working');
gotoAndPlay("Residential");
}

also try going to the frame called "Residential" (have you created this frame?
have you named it in the properties pane?) and put this code at the very top
of the actionscript window:

trace("Well, at least i've arrived at the Residential frame");

you get the idea? find out where it's breaking down and you'll have a clue
about why it's not working.


robert5c
4/13/2004 5:16:57 PM
ok...to respond to what you have said really quickly sneaky...the button works
fine...what happens when i press it is it goes to the residential fram instance
in the menu movie (same movie all is happing in)...and plays the action that i
want (a box runs across the screen then goes back to where it came from...the
only thing is that i have these movies...that are my sub menu's and on load
they are said to not be visibile...but i want them to become visible once the
animation hits a sertain frame setting off the action script to make it
visible...and that is the only problem i am having...it works fine and great
for the first three...(company, contact and projects)...but does not for the
rest...my only issue is making that movie show up...if you can just tell me how
to have a movie not visible on load but then visible apon mouse click or action
then that helps too...when i put up the code...the last two things in the
code...the residential and commercial...are the movies that should be turning
visible but they don't...in the residential one...apon posting the code...i
made the action script hidden so that the movie would just pop up without ever
hiding...just to make sure that the movie atleast was showing fine (no layer in
the way or anything)...so yea any help i appreciate..thanks
robert5c
4/13/2004 5:40:33 PM
ok sneaky...i went after you spoke and tried to resolve the problem...and i
couldn't find where instance naming took place...finaly i stumbled over it
accidently when trying to move the movie...and changed it...and yup that did
the trick...ok thanks a bunch man...the first thing i was talking about being
all the same...was the frame name...ok well thanks man...later
sneakyimp
4/13/2004 6:18:49 PM
glad you found it.

my experience with flash has been that if something just simply doesn't work,
it's usually that you haven't properly referenced an object...this can mean you
either don't have the right path to the object (e.g., '_parent._parent.object'
or '_root.object') or that you have mispelled the instance name you gave the
object or perhaps forgot to give it a name at all. problems also happen when
two different objects have the same instance name. and flash doesn't report
any bugs or anything.

the trace function can be very useful. like

trace(object._name)

if this returns 'undefined', then your object reference is not valid...try a
different path or try checking for instance names/paths, etc.


AddThis Social Bookmark Button