Script error - RolloutClass
Hello
I'm working on a script nowdays, but I have got some problem with the Rollouts...
I made a very simple script to show you what is my problem. My goal was to create a button, wich can create a new rollout. The most interesting, that the error message is only in the first run of script, when I run this script second time, it's work.
The script:
rollout MENU "MENU" ( button On01 "On" width:90 pos:[10,10] button Off01 "Off" width:90 pos:[10,40] on On01 pressed do addRollout Rollout01 menu_windo on Off01 pressed do removeRollout Rollout01 menu_windo ) rollout Rollout01 "Rollout" ( button Button01 "Button" width:90 pos:[10,10] ) menu_windo = newRolloutFloater "Rollout" 150 180 addRollout MENU menu_windo addRollout Rollout01 menu_windo
And I got this error message when I run this script first time:
"Type error: CreateDialog requires RolloutClass, got: undefined"
It's a picture about the happenings: https://dl.dropbox.com/u/1152958/script_error.jpg
Thanks your helps in advance.
Matyrix
Comments
menu_windo =
just testing
thanks Christopher. I used
thanks Christopher.
I used the
Ahh. I see. I bet you
Ahh. I see. I bet you activated the rich text editor right? It adds in all kinds of html formatting that breaks the code snippet.
I find the best way to work most of the time is to just use the simple text box, any links you type will turn to actual links w/o any [url] tags or anything like that and any code pasted in [ code ] blocks will highlight correctly.
On occasion if I really need formatting I'll use rich text...
Christopher Grant
Admin, ScriptSpot.com
like this it's working
like this it's working perfectly:
Edited your post to add code
Edited your post to add code tags for syntax highlighting...
http://www.scriptspot.com/forums/scriptspot-how-to/how-to-post-code-snip...
Christopher Grant
Admin, ScriptSpot.com
Thank you very much, it
Thank you very much, it works :)
it's normal. Don't forget
it's normal.
Don't forget that maxscript is reading line by line, like you do when you read a book.
In your script you ask it to add or remove rollouts, from the rolloutFloater.
But at this time, it doesn t know therolloutFloater, because you create it later in the script.
to prevent this, you should create the rolloutFloater before the rollouts. like this
menu_windo = newRolloutFloater "Rollout" 150 180
rollout MENU "MENU"
(
button On01 "On" width:90 pos:[10,10]
button Off01 "Off" width:90 pos:[10,40]
on On01 pressed do
addRollout Rollout01 menu_windo
on Off01 pressed do
removeRollout Rollout01 menu_windo
)
rollout Rollout01 "Rollout"
(
button Button01 "Button" width:90 pos:[10,10]
)
addRollout MENU menu_windo
addRollout Rollout01 menu_windo
Thanks your
Thanks your comment!
Unfortunately your corrected script is not work... I tried to run it on three different computers, but the first time always send error messages... Of course the second run is always works, but it's not a good solution...
What's the wrong?... I don't understand...