Author Topic: Flash Game Dev Tip #6 [SOLVED]  (Read 1225 times)

jay732

  • New Member
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Flash Game Dev Tip #6 [SOLVED]
« on: Fri, Apr 29, 2011 »
I followed the tutorial and everything works fine except for this line:

startButton = new FlxButton(120, 90, startGame);

I get an error of:

col: 41 Error: Implicit coercion of a value of type Function to an unrelated type String.

I downloaded the latest master of Flixel today (04/29/11).

The tutorial is at:

http://www.photonstorm.com/archives/1200/flash-game-dev-tip-6-setting-up-flashdevelop-and-flixel-for-the-first-time
« Last Edit: Fri, Apr 29, 2011 by jay732 »

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: Flash Game Dev Tip #6
« Reply #1 on: Fri, Apr 29, 2011 »
just double-check the order of parameters for FlxButton, make sure the label and callback are in the right order

jay732

  • New Member
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Flash Game Dev Tip #6
« Reply #2 on: Fri, Apr 29, 2011 »
I eliminated the parameter startGame and it worked fine because of the startButton.label declaration in the line that followed.

Here is the code in case anyone wanted to see:

ORIGINAL:

gameTitle = new FlxText(0, 0, 80, "Start Game");
         gameTitle.alignment = "center";
         gameTitle.color = 0x8000FF;
         startButton = new FlxButton(120, 90, startGame);
         startButton.label = gameTitle;
         startButton.labelOffset = new FlxPoint(0, 3);
         add(startButton);

FIXED:

gameTitle = new FlxText(0, 0, 80, "Start Game");
         gameTitle.alignment = "center";
         gameTitle.color = 0x8000FF;
         startButton = new FlxButton(120, 90);
         startButton.label = gameTitle;
         startButton.labelOffset = new FlxPoint(0, 3);
         add(startButton);

Should I notify the author of the tutorial about this problem? I didn't see anyone else mentioning it.

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Flash Game Dev Tip #6
« Reply #3 on: Fri, Apr 29, 2011 »
I'll update the tutorial, well spotted.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

jay732

  • New Member
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Flash Game Dev Tip #6
« Reply #4 on: Fri, Apr 29, 2011 »
Glad I could help. I'm just getting started into Flash/AS3 after getting tired of my monotonous job of 20 years working for an arcade game manufacturer and never being able to do any actual programming. This seems like a good place to start a new hobby that may prove profitable (at least a little bit).

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Flash Game Dev Tip #6 [SOLVED]
« Reply #5 on: Fri, Apr 29, 2011 »
I've updated the article, and changed it to be just this:

Code: [Select]
gameTitle = new FlxText(0, 0, 80, "Start Game");
gameTitle.alignment = "center";
gameTitle.color = 0x8000FF;

startButton = new FlxButton(120, 90, "My Game", startGame);

Easier and still works when you click the button :)

Good luck with your foray into Flash. Which company did you work for btw?
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

jay732

  • New Member
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Flash Game Dev Tip #6 [SOLVED]
« Reply #6 on: Fri, Apr 29, 2011 »
I work for Coastal Amusements, Inc,. which has nothing to do with flash programming except for their lame website. I did their non-flash pages for a while, but now they outsourced the whole job to someone else. I've worked my way up from assembler/builder to quality control to "someone who works with developers in quality control, and do factory quality control, and do factory work when needed, and take care of truck loading logistics, and serializing of all finished products".

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Flash Game Dev Tip #6 [SOLVED]
« Reply #7 on: Fri, Apr 29, 2011 »
Are proper arcade games still made? Over here (UK) they are all but dead, just gambling machines left :(
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius