Ambiguous reference to b2FilterData - actionscript-3

When I write this code below:
var mWorld:b2World = new b2World(gravity, false);
Why am I getting this error "Ambiguous reference to b2FilterData"?

Related

Uncaught TypeError: $(...).tableToJSON is not a function

Has something changed with this great jquery plugin? I keep getting this "Uncaught TypeError: $(...).tableToJSON is not a function" -error although I have resources correct.
Here is the example.
<script>
$('#convert-table').click( function() {
var table = $('#example-table').tableToJSON(); // Convert the table into a javascript object
console.log(table);
alert(JSON.stringify(table));
});
</script>
refer this link
http://lightswitch05.github.io/table-to-json/

Umbraco 7 macro script, get node by id fails

i been trying to get a node by a id with razor in a marco
but can't get it to work with all the samples.
My code look like this
#using umbraco.MacroEngines
#inherits umbraco.MacroEngines.DynamicNodeContext
#{
var temp = Parameter.myFolderId;
#temp;
var node = #Library.NodeById(temp);
}
I got the temp's value, but i can't get the node.
i also tried it like this
var node = #Model.NodeById(temp);
The only error Umbraco shows is
Error loading MacroEngine script (file: myfile.cshtml)
I'm kinda new to Umbraco, so i could be a rookie mistake
I'm thinking there shouldn't be a # before Library.NodeById, since you're already inside a code block?
#{
var temp = Parameter.myFolderId;
var node = Library.NodeById(temp);
}
Found the problem.
There was a problem with my indexes following this thread

How can I clone an object?

I'll need to clone some objects that have several types of instances. I've searched using a search engine and found some examples however I got error after I tested them.
Example: AS3 - Clone an object
import Line;
import OtherClass;
// Set lines
var obj1:Object={
environmentLine:new EnvironmentLine(),
lineX:100,
lineY:100
};
addChild(obj1.environmentLine);
var line:Line = new Line();
line.clone(obj1);
This gives me error: Line.as, Line 12, Column 3 1170: Function does not return a value.
Example: https://gist.github.com/PrimaryFeather/6914861
import com.gamua.flox.*;
import com.gamua.flox.utils.*;
import com.gamua.flox.events.*;
// Set lines
var obj1:Object={
environmentLine:new EnvironmentLine(),
lineX:100,
lineY:100
};
addChild(obj1.environmentLine);
var clone:Object = new cloneObject(obj1);
This code is giving me warning: TypeError: Error #1064: Cannot call method global/com.gamua.flox.utils::cloneObject() as constructor.
at Untitled_07_fla::MainTimeline/frame1()
Example: https://code.google.com/p/as3-commons/source/browse/trunk/as3-commons-lang/src/main/actionscript/org/as3commons/lang/ObjectUtils.as?r=1784
import org.as3commons.lang.ObjectUtils;
var num:int = 0;
// Set lines
var obj1:Object={
environmentLine:new EnvironmentLine(),
lineX:100,
lineY:100
};
var objectUtils:ObjectUtils = new ObjectUtils();
objectUtils.clone(obj1);
This gives me error: org\as3commons\lang\ObjectUtils.as, Line 211, Column 69 1046: Type was not found or was not a compile-time constant: IIterator.
Which one is the best for cloning an object and how can I fix the errors? Or is there a good library?
Boddy you should search more on Google. This is well discussed topic on many places:
https://gist.github.com/PrimaryFeather/6914861
http://www.tomauger.com/2009/flash-actionscript/actionscript-3-gotchas-copy-by-reference-deep-copy-and-read-only-objects
AS3 - Clone an object

JSON.parse(dt) doesn't work at all, give all the errors it can imagine

I have this code at server side (nodejs):
socket.on('data', function(dt){
var rdata = dt;
var msg = JSON.parse(rdata);
broadcast(msg);
});
Also I tried this way: var msg = JSON.parse(dt);
dt gets either:
{"chat":"hey","nickname":"nick_name"} OR
'{"chat":"hey","nickname":"nick_name"}'
Also I have this at the client side (AS3), tried both:
var msg = JSON.stringify({nickname: nname.text, chat: input_txt.text}); OR
var msg = "'" + JSON.stringify({nickname: nname.text, chat: input_txt.text}) + "'";
That is what console gives:
undefined:1
{"chat":"hey","nickname":"nick_name"}
^
SyntaxError: Unexpected token
DEBUG: Program node app exited with code 8
Also in some other situations, it gives all kinds of messages.
Just have no idea what is going on.
BTW, also tried JSONStream, still doesn't work.
What kind of socket exactly are you using? If you are using a websocket you might have already received an object as a response (I think most frameworks do so). If you are using plain net.socket you might be receiving a buffer or the data in chunks and not all at once. This seems like an appropriate fix for that situation:
var buffer;
socket.setEncoding('utf8');
socket.on('data', function(data) {
buffer += data;
});
socket.on('end', function() {
var object = JSON.parse(buffer);
});
Unexpected token at the end of data string, is some ghost symbol that is not a white space. trim() doesn't work, so to substring the last symbor works. This is AS3 symbol, so we have to keep it. First you save this symbol in the new variable. the you erase this symbol from the line. After that you can parse the string. work with it.
undefined:1
{"chat":"hey","nickname":"nick_name"}
^
SyntaxError: Unexpected token
DEBUG: Program node app exited with code 8
When you finish working with it, stringify the object, then add ghost symbol to the end and send over the socket. Without this symbol AS3 will not parse the data.
I don't know why is that, but that works for me.

JSONP and invalid label

Using mootools and JsonP I get "invalid label" error in Firefox Error console
JsonP seems to work (I get the data correctly)
{"jsondata":[{"title":"title1","link":"http://xxxx.xxx.xxx","thumbsrc":"http://xxxx.xxx.xxx/17_t.jpg" ,"description":".......","pubDate":"2009-03-09 06:26:00",},{"title":"title2","link":"http://xxxx.xxx.xxx","thumbsrc":"http://xxxx.xxx.xxx/16_t.jpg" ,"description":".......","pubDate":"2009-03-09 06:08:09",}]}
but I get the Invalid label error on "jsondata"
the same file works good with request.json
comma removed... nothing
this is the code I'm using
window.addEvent('domready', function() {
var gallery = $('gallery');
new JsonP('http://myjsoncodeurl',{
onComplete: function(jsonObj) {
addImages(jsonObj.jsondata);
}
}).request();
var addImages = function(images) {
images.each(function(image) {
var el = new Element('div', {'class': 'item'});
var name = new Element('h3').inject(el);
var a1 = new Element('a', {'href': image.link,'html': image.title}).inject(name);
var desc = new Element('span', {'html': image.description}).inject(name, 'after');
var a2 = new Element('a', {'href': image.link}).inject(desc,'after');
var img = new Element('img', {'src': image.thumbsrc}).inject(a2);
el.inject(gallery);
});
};
});
it works with normal request.Json, but JSONP that doesn't like my code :(
the same file works good with
request.json
With JSONP, your response should be returning a JavaScript function call (i.e. callback) with the JSON data passed in as the argument. If your response is a plain old JSON text, it won't work in the context of JSONP. You have to tailor your backend to accept a callback argument and call that callback with the JSON data.
You need to put brackets (normal ones, not curly ones) around your object, because sometimes Javascript gets horribly confused and thinks you're doing a label statement, a statement type that I didn't know existed until I Googled this problem.
https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Statements#label_Statement
Try passing your object, {"jsondata":[ ... ]} , as ({"jsondata":[ ... ]}) instead. That seems to sort it.
Putting it in here:
http://json.parser.online.fr/
Shows that its valid, but has the extra comma (which will bork IE, although FF should handle it). If removing the comma doesn't fix it, you'll need to post more of your code to help us find the error.
This could be due to the extra commas after the dates