can't convert nil into String - as3

11 views
Skip to first unread message

sam

unread,
May 4, 2007, 7:47:59 AM5/4/07
to AsProjectUsers
Hi,
I'm getting this error when trying to compile an as3 project:

(in /Users/sam/Desktop/test_as3project/project)
mxmlc -warnings -default-frame-rate 24 -default-background-color
#FFFFFF -default-size 600 400 -output bin/
test_as3projectApplication.swf -sp=assets/img src/test_as3project.as
rake aborted!
can't convert nil into String

I do have flex builder and the flex sdk installed, any ideas?

Also, i noticed in your screencast that the asunit files were being
created when creating a project, when I create one they do not appear:

>> Created file at: ./test_as3project
>> Created file at: ./test_as3project/project/assets/img/skins/Default/PatternPark.jpg
>> Created file at: ./test_as3project/project/assets/img/skins/DefaultSkin.as
>> Created file at: ./test_as3project/project/rakefile.rb
>> Created file at: ./test_as3project/project/src/test_as3project.as
>> Created file at: ./test_as3project/project/src/test_as3projectRunner.as

Thanks for any help. Great work

Luke Bayes

unread,
May 4, 2007, 11:25:31 AM5/4/07
to asproje...@googlegroups.com
Hey Sam,

I just created a new project with that name and everything seems to be working over here. Would you mind running rake with the '--trace' option and sending the output of that?


Thanks,


Luke Bayes
AsProject

Sam Luther

unread,
May 4, 2007, 12:39:32 PM5/4/07
to asproje...@googlegroups.com
Hi Luke,

Here's the trace:


mxmlc -warnings -default-frame-rate 24 -default-background-color #FFFFFF -default-size 600 400
 -output bin/test_as3projectApplication.swf -sp=assets/img src/test_as3project.as
rake aborted!
can't convert nil into String
/usr/local/lib/ruby/gems/1.8/gems/asproject-0.1.118/lib/tasks/mxmlc.rb:75:in `join'
/usr/local/lib/ruby/gems/1.8/gems/asproject-0.1.118/lib/tasks/mxmlc.rb:75:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/asproject-0.1.118/lib/tasks/mxmlc.rb:58:in `define'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1 /lib/rake.rb:387:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke'
/usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1 /lib/rake.rb:350:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:364:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:999:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.1/lib/rake.rb:363:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:356:in `invoke'
/usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.1/lib/rake.rb:350:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:364:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:999:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.1/lib/rake.rb:363:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:356:in `invoke'
/usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.1/lib/rake.rb:350:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:364:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:999:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.1/lib/rake.rb:363:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:356:in `invoke'
/usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.1/lib/rake.rb:350:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.1/bin/rake:7
/usr/local/bin/rake:18

Luke Bayes

unread,
May 4, 2007, 12:54:47 PM5/4/07
to asproje...@googlegroups.com
Ok - one more request.

Can you send me the :compile_main rake task from your rakefile.rb?

Thanks,

Luke Bayes

Sam Luther

unread,
May 4, 2007, 1:06:38 PM5/4/07
to asproje...@googlegroups.com
here's my rakefile

require 'rubygems'
require 'asproject'
require 'tasks/asunit'

# NOTE: The asclass tools will load this file
# and use these constants...
SRC_DIR             = 'src'
TEST_DIR            = 'test'
LIB_DIR             = 'lib'
BIN_DIR             = 'bin'
SKIN_DIR            = 'assets/img'
DEFAULT_TEMPLATES   = ['as3']

############################################
# Launch the Application using Flash Player 9

desc "Compile and run main application"
task :run => :compile_main
task :default => :run

AsProject::FlashPlayer.new(:run) do |t|
  t.version = 9
  t.swf = BIN_DIR + '/test_as3projectApplication.swf'
end

############################################
# Launch the Test Suites using Flash Player 9

desc "Compile and run test suites"
task :test => [:asunit3, :compile_tests]

AsProject::FlashPlayer.new(:test) do |t|
  t.version = 9
  t.swf = BIN_DIR + '/test_as3projectRunner.swf'
end

############################################
# Compile your Application using HAMTASC

AsProject::MXMLC.new(:compile_main) do |t|
  t.default_background_color = '#FFFFFF'
  t.default_frame_rate = 24
  t.default_size = "600 400"
  t.input = SRC_DIR + '/test_as3project.as'
  t.output = BIN_DIR + '/test_as3projectApplication.swf'
  t.source_path = SKIN_DIR
  t.warnings = true
end

############################################
# Compile your Application using HAMTASC

AsProject::MXMLC.new(:compile_tests) do |t|
  t.default_background_color = '#FFFFFF'
  t.default_frame_rate = 24
  t.default_size = "800 450"
  t.input = SRC_DIR + '/test_as3projectRunner.as'
  t.output = BIN_DIR + '/test_as3projectRunner.swf'
  t.warnings = true
  t.source_path << SRC_DIR
  t.source_path << LIB_DIR + '/asunit3'
  t.source_path << TEST_DIR
  t.source_path << SKIN_DIR
end

Luke Bayes

unread,
May 4, 2007, 2:42:42 PM5/4/07
to asproje...@googlegroups.com
OK Sam,

I think I found it...

I added some code to fall back on the FLEX_HOME environment variable if MXMLC isn't found directly in the class path. It looks like this code is trying to treat the ENV['FLEX_HOME'] as a string, but it's not defined.

I should have this addressed in the next release, but for now - you can fix it locally by setting FLEX_HOME equal to the FLEX SDK location (This folder should contain the 'bin' that contains mxmlc).

Please let me know if that doesn't solve the problem.


Thanks,


Luke Bayes


On 5/4/07, Sam Luther < sam.t...@gmail.com> wrote:

Sam Luther

unread,
May 4, 2007, 3:08:01 PM5/4/07
to asproje...@googlegroups.com
Hi Luke,
Thanks for all your help. I think im closer but :


mxmlc -warnings -default-frame-rate 24 -default-background-color #FFFFFF -default-size 600 400 -output bin/test_as3projectApplication.swf -sp=assets/img src/test_as3project.as
'/Users/sam/Applications/Adobe Flex Builder 2/Flex SDK 2/bin/mxmlc' -warnings -default-frame-rate 24 -default-background-color #FFFFFF -default-size 600 400 -output bin/test_as3projectApplication.swf -sp=assets/img src/test_as3project.as
command line: Error: configuration variable 'default-background-color' expected 1 argument(s), got 0

Use 'mxmlc -help' for information about using the command line.
There was an error executing mxmlc, please make sure mxmlc is in your class path and can be executed from the same environment this rake task was run from
2007-05-04 15:06:12.750 open[3167] No such file: /Users/sam/Desktop/test_as3project/project/bin/test_as3projectApplication.swf

Luke Bayes

unread,
May 4, 2007, 3:23:51 PM5/4/07
to asproje...@googlegroups.com
Hey Sam,

Thanks for getting back...

Can you check out your mxmlc.rb file around line 116, there may be a line like:

result << "-default-background-color=" + default_background_color if default_background_color

Try changing that to:

result << "-default-background-color" << default_background_color if default_background_color

Let me know if that fixes it.


Thanks,


Luke Bayes
AsProject



On 5/4/07, Sam Luther <sam.t...@gmail.com> wrote:

Sam Luther

unread,
May 4, 2007, 3:32:22 PM5/4/07
to asproje...@googlegroups.com
there was no change needed, here's the way it looks:

Luke Bayes

unread,
May 4, 2007, 4:40:57 PM5/4/07
to asproje...@googlegroups.com
I'm really sorry for all the back and forth, but I can't reproduce the issue over here!

Here are a couple new things to try:

a) In your mxmlc.rb file, change line 116 *back* to the other line I asked you to change it from...
b) In your rakefile.rb comment the default_background_color line and see if you pass

Thanks,


Luke

Luci3n

unread,
May 4, 2007, 6:35:59 PM5/4/07
to AsProjectUsers
Sam I had the same problem and a found a hack so I could move to the
next
I commented the line in the project rakefile.rb (line 41) like Luke
said and it work correctly.
#t.default_background_color = '#FFFFFF'

now the files are created but I have this error message

** Execute flash_player-9
** Invoke bin/SomeProject3Application.swf (not_needed)
** Execute run
rake aborted!
Not sure where flash_player_home should be on systems other than Win/
Mac - please let us know so that we can update this script...
/usr/lib/ruby/gems/1.8/gems/asproject-0.1.118/lib/path_finder.rb:
348:in `flash_player_home'
/usr/lib/ruby/gems/1.8/gems/asproject-0.1.118/lib/path_finder.rb:
314:in `flash_player_log'
/usr/lib/ruby/gems/1.8/gems/asproject-0.1.118/lib/path_finder.rb:26:in
`flash_player_log'


I now have this problems for both as2 and as3 compilation

Luke: What files do we need to locate and which files do we need to
change?

Luci3n

unread,
May 4, 2007, 6:50:09 PM5/4/07
to AsProjectUsers
Having looked at the options for

-default-background-color the options are int
I can use the rgb value directly but not the '#FFFFFF' when it is a
string

Luke Bayes

unread,
May 4, 2007, 7:51:43 PM5/4/07
to asproje...@googlegroups.com
Hey Clark,

Thanks so much for working through this.

About the background color fix:

What does the working line in your rakefile look like?
What does the working line 116 in your mxmlc.rb file look like?

For now, to edit those urls for linux, you need to open flash_player.rb and edit lines 38 + 39 (for as2) and 45 + 46 (for as3).

You *should* be able to get the linux player binary and place it into:

~/.asproject/downloads/flash_player-9/[filename]

and then set:

@unix_extracted_file = [filename]

Check out what it looks like for win and osx in that flash_player.rb file. This is essentially the extracted, relative path to the player executable.

The good news is that I'm actively working on the next build that will externalize *all* of this configuration crap so that we can host simple lookup config files remotely and folks won't have to dig into the gem for this stuff!


Thanks!


Luke Bayes
AsProject

Luci3n

unread,
May 4, 2007, 8:20:22 PM5/4/07
to AsProjectUsers
Sam,

If you change the rakefile.rb then following lines (41 & 54) to

t.default_background_color = 0xFFFFFF

On May 4, 10:40 pm, "Luke Bayes" <lba...@patternpark.com> wrote:

Sam Luther

unread,
May 5, 2007, 9:03:03 AM5/5/07
to asproje...@googlegroups.com
thanks Luci3n, that did the trick. Thanks for the help guys

Luci3n

unread,
May 5, 2007, 11:21:39 AM5/5/07
to AsProjectUsers
Sam

No problems glad to help

Reply all
Reply to author
Forward
0 new messages