Chrome Extension with React – gotcha

I’m rebuilding my Chrome Extension Tab List to use ReactJS (as part of my learning trip) and encountered following error:

Uncaught EvalError: Refused to evaluate a string as JavaScript because ‘unsafe-eval’ is not an allowed source of script in the following Content Security Policy directive: “script-src ‘self’ blob: filesystem: chrome-extension-resource:”.

Continue reading

Error: transcoding parameter ‘symbol’ is not supported by ‘flex2.compiler.media.DataTranscoder’

Hi,

if you’ve run on the Error: transcoding parameter 'symbol' is not supported by 'flex2.compiler.media.DataTranscoder' error recently, then you’re not alone.

I’ve updated my FlashDevelop recently (and with FD updated the Flex SDK – the offender) and one of my projects suddenly stopped publishing, the error was pointing to the Embed tag.

		[Embed(source = "../../../../../gd_logo.swf", 
		mimeType = "application/octet-stream", 
		symbol="com.greladesign.library.logo.GrelaDesignLogo" )]

I was searching on the internet, but couldn’t find anything, however good soul on FD forum has gave me the answer which is:

Remove the mime-type.

		[Embed(source = "../../../../../gd_logo.swf", 
		symbol="com.greladesign.library.logo.GrelaDesignLogo" )]

The parseCSS of StyleSheet silently fails

Hi,

when you use the parseCSS method of the StyleSheet, you will have no indication about success of the invocation. When passed string contains invalid CSS text then this method will silently fails. The workaround is to compare the lenght of the styleNames property before and after the call to parseCSS, if both values are equal then parseCSS has failed.

		protected function parseCss(stylesheet:StyleSheet, cssText:String):Boolean
		{
			if (!stylesheet)
			{
				Log.f(TAG, "Invalid argument, stylesheet can't be null.");
				return false;
			}
			if (!cssText || cssText == "")
			{
				Log.f(TAG, "Invalid argument, cssText can't be null nor empty.");
				return false;
			}
			
			var _nStylesLength:int = stylesheet.styleNames.length;
				
				stylesheet.parseCSS(cssText);
				
				
				if (_nStylesLength == stylesheet.styleNames.length)
				{
					Log.f(TAG, "There has been an error while parsing css string.");
				}
				
			return _nStylesLength != stylesheet.styleNames.length;
		}

best regards

The String’s replace method and ArgumentError: Error #1063: Argument count mismatch error

Hi,

recently I have upgraded flash player (11.1.102.55), and suddenly found that one of my components was throwing following error:


ArgumentError: Error #1063: Argument count mismatch on Main/removeLinkStyleClass(). Expected 0, got 6.
at String$/_replace()
at String/http://adobe.com/AS3/2006/builtin::replace()
at Main/init()[...\bugs\string_replace\src\Main.as:27]
at Main()[...\bugs\string_replace\src\Main.as:16]

I was surprised as the code wasn’t changed and it was working earlier. When I have opened the problematic function I’ve noticed that it is the one used in replace function as the second parameter AS3 function replace(pattern:*, repl:Object):String. As I was creating this method following up the documentation I was using the arguments object, however after the flash player update this error appeared. At first I was lost with that, but then I’ve tried with …(rest) parameter, and it worked!

So if you will have the same problem try to modify your method to include the …(rest) parameter:

function replaceFunction(...args):String
{
//do what ever you need with args and return string
}

p.s. I will try to find the FP version when it started to be a problem, maybe it was announced?:)

best regards