Error #2109 half the time - actionscript-3

I'm making a platform game in AS3.
Everything is running fine except sometimes (not each time I run the game), I've got this error :
ArgumentError: Error #2109: Frame label null not found in scene null.
at flash.display::MovieClip/gotoAndStop()
at PlatformGame/moveCharacter()[C:\...\PlatformGame.as:581]
at PlatformGame/moveEnemies()[C:\...\PlatformGame.as:360]
at PlatformGame/gameLoop()[C:\...\PlatformGame.as:348]
I don't understand AT ALL why it happens randomly..
Do you know what could be the problem ?
Here's the lines in the error :
line 581 :
char.mc.gotoAndStop(char.walkAnimation[Math.floor(char.animstep)]);
line 360 :
moveCharacter(enemies[i],timeDiff);
line 348 :
moveEnemies(timeDiff);
Thank you for your help,

You ask to 'mc' (contained in 'char') to go to the frame which number
is contained in the array 'walkAnimation' at the index: Math.floor(char.animstep).
The error you have got means that, for some reason, 'Math.floor(char.animstep)' index doesn't exist in the array 'walkAnimation'.
Exactly as if you wrote :
var frame:Array = [1, 2, 3];
gotoAndStop(frame[10]);
frame[0] is 1, frame[1] is 2, frame[2] is 3, but frame[10] is undefined.

Related

Error while loading model with RL4J

I'm using RL4J (the Reinforcement Learning framework integrated in DeepLearning4J) for making a car complete the lap in a track for a videogame.
I save the the model after the training with this code:
QLearningDiscreteConv<ScreenFrameState> dql = new QLearningDiscreteConv(mdp, RACING_NET_CONFIG, RACING_HP, RACING_QL, manager);
dql.train();
dql.getNeuralNet().save(model);
After the model is saved, I'd like to see how it behaves, and so I load it to play it:
DQN load = DQN.load(model);
QLearningDiscreteConv<ScreenFrameState> dql = new QLearningDiscreteConv(mdp, load, RACING_HP, RACING_QL, manager);
dql.getPolicy().play(mdp);
but it fails while loading with this error:
org.deeplearning4j.exception.DL4JInvalidInputException: Cannot do forward pass in Convolution layer (layer name = layer0, layer index = 0): input array depth does not match CNN layer configuration (data input depth = 109, [minibatch,inputDepth,height,width]=[1, 109, 150, 3]; expected input depth = 10) (layer name: layer0, layer index: 0)
at org.deeplearning4j.nn.layers.convolution.ConvolutionLayer.preOutput(ConvolutionLayer.java:294)
at org.deeplearning4j.nn.layers.convolution.ConvolutionLayer.preOutput(ConvolutionLayer.java:248)
at org.deeplearning4j.nn.layers.convolution.ConvolutionLayer.activate(ConvolutionLayer.java:392)
at org.deeplearning4j.nn.layers.AbstractLayer.activate(AbstractLayer.java:309)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.activationFromPrevLayer(MultiLayerNetwork.java:789)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.feedForwardToLayer(MultiLayerNetwork.java:929)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.feedForward(MultiLayerNetwork.java:870)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.feedForward(MultiLayerNetwork.java:861)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.silentOutput(MultiLayerNetwork.java:1906)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.output(MultiLayerNetwork.java:1898)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.output(MultiLayerNetwork.java:1871)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.output(MultiLayerNetwork.java:1952)
at org.deeplearning4j.rl4j.network.dqn.DQN.output(DQN.java:49)
at org.deeplearning4j.rl4j.policy.DQNPolicy.nextAction(DQNPolicy.java:32)
at org.deeplearning4j.rl4j.policy.DQNPolicy.nextAction(DQNPolicy.java:18)
at org.deeplearning4j.rl4j.policy.Policy.play(Policy.java:72)
at org.deeplearning4j.rl4j.policy.Policy.play(Policy.java:27)
at me.andreaiacono.racinglearning.rl.QLearning.race(QLearning.java:81)
at me.andreaiacono.racinglearning.core.player.QLearningPlayer.race(QLearningPlayer.java:19)
at me.andreaiacono.racinglearning.gui.GameWorker.doInBackground(GameWorker.java:56)
at me.andreaiacono.racinglearning.gui.GameWorker.doInBackground(GameWorker.java:11)
at javax.swing.SwingWorker$1.call(SwingWorker.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at javax.swing.SwingWorker.run(SwingWorker.java:334)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
The input is correct: my screen is 150 * 109 pixel with 3 color channels; why does it expect a size of 10 when loading? What am I missing?
Thanks,
Andrea
(data input depth = 109, [minibatch,inputDepth,height,width]=[1, 109, 150, 3]; expected input depth = 10)
That looks like you set inputDepth to 109, whereas it should be set to 3 (number of channels). I'm not familiar with dl4j personally, so not sure why it would say "expected input depth = 10", but I suppose you could at least try switching around the order in which you gave those arguments.
What is the version that you use? Soetimes if you use the snapshot repository, a temporary mistake is possible, but the guys fix it really quick. So by chance you might have taken code from snapshot at this moment. Take s stable version.

How to use Math.LN(x) in ActionScript 3

How to use Math.LN(x) in ActionScript 3?
I have a formula to convert:
17.867 * LN(x)-29.263
How to write in ActionScript 3? I'm confused about how to write it.
What I've tried :
var Kc:Number;
var value_x:Number;
function enterFrameHandler () : void
{
value_x=80;
Kc=(17.867)*Math.LN10(value_x) - 29.263;
value_Kc.text=String(Kc);
trace(Kc);
//y = 17.867ln(x) - 29.263//
}
enterFrameHandler();
Getting error :
Error : Scene 1, Layer 'Layer 1', Frame 1, Line 7, Column 19 1195 :
Attempted access of inaccessible method LN10 through a reference with
static type Class.
thanks for your replied #Organis may be directly show problem in my code
var Kc:Number;
var value_x:Number;
function enterFrameHandler () : void
{
value_x=80;
Kc=(17.867)*Math.LN10(value_x) - 29.263;
value_Kc.text=String(Kc);
trace(Kc);
//y = 17.867ln(x) - 29.263//
}
enterFrameHandler();
///get error Scene 1, Layer 'Layer 1', Frame 1, Line 7, Column 19 1195: Attempted access of inaccessible method LN10 through a reference with static type Class.//

Hovertool Bokeh "Cannot read property"

My problem is that in Chrome, when I have my cursor on my histogram hover my data, I have this error :
Uncaught TypeError: Cannot read property '0'
There is my code :
hist, edges = np.histogram(data,bins=3000)
plot = quad(
top=hist,
bottom=0,
left=edges[:-1],
right=edges[1:],
fill_color="#036564",
line_color="#033649",
tools="pan,wheel_zoom,box_zoom,reset, hover",
x_range=[-0.5,3.5],
plot_width=1100,
title="",
)
hover = plot.select(dict(type=HoverTool))
hover.tooltips = [('index','$index')]
resources = Resources("inline")
plot_script, plot_div = components(plot, resources)
html_script = mark_safe(encode_utf8(plot_script))
html_div = mark_safe(encode_utf8(plot_div))
figure()
return html_script, html_div
"data" is a array like this :
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.24,1,1.32,1,2,3]
I tried to add a "source" in the quad, changed the figure, changed my code for the one on the documentation but I still have my error.
For information, everything is working very well, except the hover tool.
Indeed, in the "hover box" I want another informations then just "index", but it's just for testing.
Thanks for reading !
Sorry I missed this earlier. You have uncovered a small bug with the hover tool that is particular to quad glyphs. In the mean time you can add hover.snap_to_data = False to get it to work.
Here is a GH issue you can track for the full solution:
https://github.com/bokeh/bokeh/issues/1644
A fix should be in the 0.7.1 release next Monday.
Also BTW, you are using a deprecated API. You should now write code like:
p = figure(...)
p.quad(...)

AS3 #1008 Error, Level Change

I know Im probably missing something stupidly easy, but Im trying to set up a level change in my game. Once the score variable hits 100 I want some dynamic text to change to Level 2, instead it gives me a null error specifically
"TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Cat_fla::MainTimeline/NextLevel()"
Here is the code:
var level:Number = 1;
addEventListener(Event.ENTER_FRAME,NextLevel);
function NextLevel(event:Event):void{ //Checks if player is at next level pionts. Changes Level count.
if (score==100) {
level += 1;
}
levelCount.text = "Level: " +String(level);
}
It specifically pulls up " levelCount.text = "Level: " +String(level); " . So I imagine its to do with the String being there depite being declared as a Number, but I used a similar system to keep score and that worked fine.

Decoding Stack Trace error

I am looking at the crash history and the following appears. Is there a way to identify what is the error or how to resolve? Is there any place where it identifies the error codes?
Exception Type: system.exception
Frame Image Function Offset
0 windows_ni Windows.Phone.Speech.Recognition.SpeechRecognizer..ctor 0x00000001
1 carparkcommon_ni GetMeALot.Helpers.Speech.Initialize 0x00000040
2 getmealot_ni GetMeALot.MainPage+_PhoneApplicationPage_Loaded_d__b.MoveNext 0x0000007e
3 mscorlib_ni System.Runtime.CompilerServices.AsyncMethodBuilderCore._ThrowAsync_b__0 0x00000036
Exception Type: system.argumentoutofrangeexception
Frame Image Function Offset
0 system_core_ni System.Linq.Enumerable.ElementAt[[System.__Canon,_mscorlib]] 0x00000122
1 carparkcommon_ni GetMeALot.Helpers.Speech.Initialize 0x00000128
2 getmealot_ni GetMeALot.MainPage+_PhoneApplicationPage_Loaded_d__b.MoveNext 0x0000007e
3 mscorlib_ni Runtime.CompilerServices.AsyncMethodBuilderCore._ThrowAsync_b__0 0x00000036
It looks to be related to your creation of a new SpeechRecognizer in the Loaded event of the MainPage.