开发者

FLASH Bulder Type 1136: Incorrect number of arguments. Expected 2. - JSON

I'm making a Youtube Downloader in Flash Builder using the tutorial on http://www.thetechlabs.com/tech-tutorials/audionvideo/creating-a-downloader-for-youtube-with-flexair-2/ but I'm getting an error in my code here

public function getFLVURL( sHTML:String ) : String {
                var swfArgsFound:Array = sHTML.match( /var swfArgs =(.*?);/ );
                **var swfArgsJS:JSONDecoder = new JSONDecoder( swfArgsFound[1] );**
                var swfArgs:Object = swfArgsJS.getValue();

                var url:String = 'http://youtube.com/get_video.php';
                var first:Boolean = true;
                for( var k:String in swfArgs ) {
                    if ( swfArgs[k] != null && swfArgs[k].toString().length > 0 ) {
                        url += first ? '?' : '&';
                        开发者_开发知识库first = false;
                        url += k+'='+escape(swfArgs[k]);    
                    }
                }
                return url;
            }

The error is saying there is an incorrect number of arguments, expected 2. However I can't figure out what the second argument is. The tutorial, from what I can tell was written for Air 1.0 so maybe things have changed since the tutorial was written. Any ideas?


I assume your 'starred' line is causing the error? Are you using the AS3CoreLib library?

Did you look at the code for this class?

The first parameter is the string you want to decode. The second one is named 'strict' which I assume relates to how the code is decoded. Per the docs:

strict Flag indicating if the JSON string needs to strictly match the JSON standard or not.

With all due respects, how did this get to the point where you even had to ask the question?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜