A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Expected a field name after '.' operator.

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    7

    Expected a field name after '.' operator.

    I am trying to make an animation (transition) on a button useing actionscript and calling the MC from the library to the button. Problem is I get an error when I run it

    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Expected a field name after '.' operator.
    myButton.on(rollOver)=function(){

    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 4: Expected a field name after '.' operator.
    myButton.on(rollOut)=function(){

    Total ActionScript Errors: 2 Reported Errors: 2

    I dont understand what this meens.

    my code on the frame is:

    myTargetSwitch1 = "off";

    _root.mcFadein.onEnterFrame=function(){
    if(myTargetSwitch=="off"){
    this.gotoAndStop('stopped');
    }else{
    this.gotoAndPlay('fadein');
    }
    }

    and the code on the button is:

    myButton.on(rollOver)=function(){
    myTargetSwitch1="on";
    }
    myButton.on(rollOut)=function(){
    myTargetSwitch1="off";
    _root.mcFadein.gotoAndPlay('fadeout');
    }

    does anyone have any suggestions?

  2. #2
    Junior Member
    Join Date
    Feb 2010
    Posts
    7
    sorry my flash version is flash 8

  3. #3
    Member
    Join Date
    Oct 2009
    Posts
    46
    If you write your button actions in actionscript on a frame, the code is a little different than if you write it on the button itself. The code should be

    myButton.onRollOver=function(){
    myTargetSwitch1="on";
    }
    myButton.onRollOut=function(){
    myTargetSwitch1="off";
    _root.mcFadein.gotoAndPlay('fadeout');
    }

  4. #4
    Junior Member
    Join Date
    Feb 2010
    Posts
    7

    Must appear within on handler

    Ok I switched the code on the button and now I get the following error;

    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement must appear within on handler
    myButton.onRollOver=function(){

    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 4: Statement must appear within on handler
    myButton.onRollOut=function(){

    Total ActionScript Errors: 2 Reported Errors: 2


  5. #5
    Member
    Join Date
    Oct 2009
    Posts
    46
    wait- is the code on the button or on a frame?

    if the code is on a frame it should use:
    myButton.onRollOver = function{

    if it is on a button it should use:
    on(rollOver){

  6. #6
    Junior Member
    Join Date
    Feb 2010
    Posts
    7

    Nothing Happened

    Ok so I changed the frame code and the buttoncode and nothing is happeneing. There is suppose to be a box that fades in when you hover over the button and fades out when you move out of it. But nothing is happeneing. There are no errors.

  7. #7
    Member
    Join Date
    Oct 2009
    Posts
    46
    Well at least we fixed the original problem. Sounds like an issue with what you are telling the button to do. Its very hard to tell what exactly is going on from the copy and pasted code above. It seems overly complicated for what you are trying to accomplish, but I don't know. Perhaps if you could post the source file it would help...

  8. #8
    Junior Member
    Join Date
    Feb 2010
    Posts
    7

    The app is really laggy

    I'm running into the problem of huge lag when I run the app. I know that it might help if I call everything to the stage instead of having it physically on the stage. so the first thing I want to do is call the mouse pointer to the stage does anyone know how to do that?

    I already have the code to replace the pointer and hide the regular one. I just need to know if in Flash 8 you can call the new pointer to the stage instead of having to place one on every frame.

    thank you for the help.

  9. #9
    Member
    Join Date
    Oct 2009
    Posts
    46
    Sorry, not really sure about replacing mouse pointers, but pretty much anything can be put on the stage with actionscript, so I doubt you need to put something on the stage in every frame. I would start a new thread though, the title of this one doesn't really have anything to do with your new question, so you might not get an answer. good luck though..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center