View Full Version : What is the name in code of MC inside MC?
Coisox
09-13-2008, 05:43 PM
I dont know whats the best keywords to Google for this problem. I've tried a few but still didn't work.
I create a MC (drag from the Library into the Stage) and then create another dynamic text inside the MC. So now I didn't know what the full name of the dynamic text inside coding.
I named MC = MC1
I named dynamic text = myScore
In coding, I tried this code, MC1.myScore.text = "hello" but return this error:
1119: Access of possibly undefined property myScore through a reference with static type flash.display:SimpleButton.
I've also tried, (root as MovieClip).myScore.text = "Hello" which didn't return error but not working as I want.
snickelfritz
09-13-2008, 06:08 PM
"mc" is a movieclip in the library, with "myScore" dynamic textfield nested within it.
(use camelCase with the first character lowercase for movieclip instance names)
Drag an instance of "mc" onto the stage.
Give it an instance name of "mc1".
add this script to the actions layer:
mc1.myScore.text = "hello";
If you are using this symbol as a button to trigger a function:
mc1.buttonMode = true;
mc1.mouseChildren = false
Coisox
09-13-2008, 06:22 PM
Oh my!! Thank you for indirect highlighten my mistakes (actually I don't know it was a mistake). After reading your second section, I check my objects.
Actually in the Library, it is not a movieclip but a button! I thought it doesn't matter but I use button so that the mouse change when Mouse_Over :)
So after changing from button to mc, its ok.
snickelfritz
09-13-2008, 06:35 PM
Most of the display objects you work with in Flash will be movieclips or sprites.
Button symbols are a quick'n'dirty method for building a generic interface quickly.
Advanced Flash developers do not use them very often, if at all.
(I never use them; coded movieclips are far more versatile)
BTW, I didn't mean to insinuate that you made a "mistake" with your naming convention, only that as your skills become more advanced, you will find it very beneficial(mandatory in some cases) to conform to established naming conventions.
Coisox
09-13-2008, 06:43 PM
Actually I use button because it wont be use regularly. I thought movieclip is much "heavier" since it has a lot of properties and function. I didnt use button because it is easy but because it has limited function which I believe will perform better on slower machine.
snickelfritz
09-13-2008, 07:18 PM
I thought movieclip is much "heavier" since it has a lot of properties and function. I didnt use button because it is easy but because it has limited function which I believe will perform better on slower machine.
All of the above is basically false.
A button is no more or less processor intensive than a movieclip or sprite coded to do the same thing. (swap a set of static properties on rollover/rollout/click)
The timeline itself is a movieclip, so instances of movieclips will have all of the properties and versatility of the timeline, including (as you now know) the capacity contain scriptable child objects.
As I said, you will almost certainly outgrow the use of button symbols very quickly.
It really does not save any time at all, and is not actually "easier" than coding movieclips, once you've learned how to write the actionscript.
(You will eventually just create your own reusable classes than can be imported and applied to movieclips very easily.)
GL
Coisox
09-13-2008, 07:20 PM
Thank you for enlighten me. :)
alpdog14
09-16-2008, 03:57 PM
I have a Flash Contact form that works perfectly by iteself on a server when I embed it into a HTML doc. The information comes right to my designated email I inputted. I have another Flash Website Movie that I want this Flash Contact Form to work in but every time I try to import the Contact Form movie it does not even show the form it only shows the "Connecting to Server" layers that appear when you click the Submit button. When I import it automatically turns the Form into a Graphic which I changed to a Movie but it still just shows the "Connecting to Server" screen instead of the form. Like I stated the Contact form by itself works perfectly fine when embedded into a HTML doc. Please anyone that can help would be most appreicated.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.