dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: dumb '{' error

  1. #1
    Junior Member
    Join Date
    Sep 2009
    Location
    Cleveland, OH
    Posts
    3

    dumb '{' error

    hi! I'm just trying to get up and running with mobile devices by using the lynda.com tutorials. But I'm stuck because I keep getting an error that prevents the rest of the script from running. I'm on flashcs4, using device central, and the error is '{' expected on line 41 of the script, which is as follows...

    Selection.setFocus(btnNews);

    this.onKeyDown = function()
    {
    switch(Key.getCode())
    {
    case ExtendedKey.SOFT1 :
    fscommand2 ("Quit");
    break;
    case ExtendedKey.SOFT2 :
    this._parent.attachMovie("Status", "Status", 0);
    break;
    default :
    trace("Pressed some key");
    }
    }
    Key.addListener(this);

    if( System.capabilities.hasSharedObjects)
    {
    SharedObject.addListener("soLastSelection", showLastSelection);
    var soLastSelection:SharedObject = SharedObject.getLocal("soLastSelection");
    }

    function showLastSelection(argSo:SharedObject)
    {
    if( argSo.data.lastButton)
    {
    Selection.setFocus(argSo.data.lastButton);
    }
    else
    {
    Selection.setFocus(btnNews);
    }
    }

    btnNews.onRelease = loadScreen;
    btnUpcomingShows.onRelease = loadScreen;
    btnEverythingElse.onRelease = loadScreen;

    function loadScreen():void
    {
    var clipName:String = this._name;
    clipName = clipName.substring( 3, clipName.length );
    if(System.capabilities.hasSharedObjects)
    {
    soLastSelection.data.lastButton = this;
    soLastSelection.flush();
    }
    this._parent._parent.attachMovie( clipName, clipName, 0);


    }
    I've accounted for all the curly braces, so I dont see what it could be. But if there is something obvious going on that I dont see, I would appreciate the input. Thanks!

  2. #2
    Senior Member
    Join Date
    Jan 2004
    Posts
    141
    Hi.
    In your Publish Settings (File > Publish Settings) look in the 'Flash' tab. Check your 'Actionscript Version' is set to 'Actionscript 2.0'. I suspect it's set to 'Actionscript 1.0' and I dont think 1.0 supports function return types....
    It's the ':void' which is causing the issues.

    CP.

  3. #3
    Junior Member
    Join Date
    Sep 2009
    Location
    Cleveland, OH
    Posts
    3
    yes!

    Thanks a bunch for your insight!

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