jerry
March 17, 2003, 10:14pm
1
Here’s the case:
I found some code that works great with Flash 5, but I can’t get it to work with MX:
onClipEvent (enterFrame) {
if(Selection.getFocus() == null || Selection.getFocus() != "_level0.mytext")
{
if(_currentFrame > 0)
{
prevFrame();
}
return;
}
if(_currentFrame < _totalframes)
{
play();
} else {
stop();
}
}
I’m not that good at actionscripting, so I can’t quite figure it out!
The script is used to play a movieclip when selecting a input textbox (with a var name of “mytext”)
Could someone please translate it into MX code!? :sigh:
system
March 18, 2003, 2:40am
2
try this instead
selection.onEnterFrame = function() {if(Selection.getFocus() == null || Selection.getFocus() != “_level0.mytext”)
{
if(_currentFrame > 0)
{
prevFrame();
}
return;
}
if(_currentFrame < _totalframes)
{
play();
} else {
stop();
}
}
Grim
system
March 18, 2003, 2:40pm
3
Hmmm…
I get the following error applying that piece of code to my MC:
Scene=Scene 1, Layer=Layer 1, Frame=1: Line 1: Statement must appear within on/onClipEvent handler
selection.onEnterFrame = function() {if(Selection.getFocus() == null || Selection.getFocus() != "_level0.mytext")
system
March 18, 2003, 2:46pm
4
Why do you need return; there??? I think that is causing the problem… That code itself should be working fine whether it is used in F5 or FMX…
system
March 18, 2003, 4:18pm
5
Take a look at this, perhaps that would help! The test01.swf is saved as a flash 5 file!
system
March 19, 2003, 6:55am
6
File works just fine on my FMX… What seems to be the problem???
system
March 19, 2003, 2:24pm
7
Because it’s still in flash 5, but try to export the .fla to a Flash MX .swf file - THATS the problem! then, it won’t work!!
system
March 20, 2003, 5:22am
8
Now I get it…
Click on the text field… You see ‘mytext’ in the Variable area??? Remove ‘mytext’ from there, and put it in the instance name area which is right below the drop down box that says ‘Input Text’…
Go to export setting, and set it to export to Flash 6…
Run the movie to test…
I think this is what you want… Let me know…
system
March 20, 2003, 10:59pm
9
hehe… so simple - THATS it!
THX mate! <:}
system
March 20, 2003, 11:20pm
11
Hmmm… but that brings up a new question:
I want to put it inside a movieclip - but then it wont work… again! :*(
Has it something to do with _level1.mytext
system
March 20, 2003, 11:28pm
12
Um… Then, I guess, you should tell the exact path like this???
_level1.yourMCInstanceName.mytext
system
March 20, 2003, 11:33pm
13
***… I tried that, but it won’t do the trick! : (
system
March 20, 2003, 11:39pm
14
Sorry mate, something went worng the first time - you where right! IT WORKS!
system
March 20, 2003, 11:43pm
15
It’s working just fine to me???