Flex, ActionScript - StringUtil - actionscript-3

I am trying to edit an already existing Flex project, and I see a warning on the line
"import com.Adobe.utils.StringUtil;" and the warning it shows is
Multiple markers at this line:
-mx
-The import utils could not be found.
-The import StringUtil could not be found.
so what could be the problem?
Well I was wondering what is the difference between import com.Adobe.utils.StringUtil; and import mx.utils.StringUtil;

com.adobe.utils.StringUtil and mx.utils.StringUtil are different classes. From the manual of mx.utils.StringUtil:
The StringUtil utility class is an all-static class with methods for working with String objects within Flex.
Mark that within Flex part.
And com.adobe.utils.StringUtil is part of Adobe's as3corelib which is a pure AS3 library and offers different methods. You need to add the as3corelib's StringUtil to remove the warning.

com.adobe.utils.StringUtil is from the as3corelib -- https://github.com/mikechambers/as3corelib
If this is not included in your project, then flex can't find it. You can either include it or change all imports to use the mx path. However, there might be a specific reason the as3corelib was included in the old project, so be aware of that.

Related

Cannot figure out how to use the OfficeExtension.Promise

Currently I am trying to use the OfficeExtension.Promise polyfill offered by Microsoft for developing Office Add-Ins. Unfortunately I am not able to get it to work thus far. From what I can tell these are only offered in the WordApi 1.2 and ExcelApi 1.2. Since I could not find separate node modules offering these api's I presume that these are included in the normal '#microsoft/office-js' node module. Additionally I have installed the office-js types as well.
Node modules
Import statements
So far I have tried importing the 'OfficeExtension' class/namespace in the following ways.
import {OfficeExtension} from '#microsoft/office-js'
import {OfficeExtension} from 'office-js'
import {OfficeExtension} from '#types/office-js'
Error
All of these result in an intellisense error stating that the module cannot be found.
Question
The concrete problem is that I do not know how to import the functionality in order to use the OfficeExtension.Promise polyfill. I could find no documentation that offers any help on this topic, so any advice or information would be greatly appreciated.
Unfortunately the error that is shown, actually states what is happening. 'office-js' does not export a module that can be used in a Typescript/React project. Office or OfficeExtension are global variables on the 'Window'. Therefore a /// tag or another script reference is needed, in order to import these variables.
Link

What does "Packages cannot be nested" in AS3 mean?

I got the complie error "Packages cannot be nested". What does it mean, and how do I fix it?
While you can have more than one Class, you should only have a single Package in each of your .as files. Check your .as files to see if you have more than one instance of Package.
Update based on OP's comments:
You cannot use Packages or Classes on the timeline. You need to place that code in an external file and link to it either by making it your Document Class or by assigning it to a symbol in your library via the Class property in the properties panel.

SimpleCV 1.3 update & pygame

I recently updated to SimpleCV 1.3. When I try to run examples I get the following:
objc[92210]: Class SDLTranslatorResponder is implemented in both /Library/Frameworks/SDL.framework/Versions/A/SDL and /usr/local/lib/libSDL-1.2.0.dylib. One of the two will be used. Which one is undefined.
objc[92210]: Class SDL_QuartzWindow is implemented in both /Library/Frameworks/SDL.framework/Versions/A/SDL and /usr/local/lib/libSDL-1.2.0.dylib. One of the two will be used. Which one is undefined.
objc[92210]: Class SDL_QuartzWindowDelegate is implemented in both /Library/Frameworks/SDL.framework/Versions/A/SDL and /usr/local/lib/libSDL-1.2.0.dylib. One of the two will be used. Which one is undefined.
objc[92210]: Class SDL_QuartzView is implemented in both /Library/Frameworks/SDL.framework/Versions/A/SDL and /usr/local/lib/libSDL-1.2.0.dylib. One of the two will be used. Which one is undefined.
WARNING: You need the python image library to save by filehandle
WARNING: You need the python image library to save by filehandle
WARNING: You need the python image library to save by filehandle
Considering this is related to the pygame installations before, when I remove the old pygame folders (There are few of them) I get the error: "ImportError: No module named pygame".
How can I get rid of this? This is something I must take care of until Tomorrow night.
ImportError means the correct folder isn't in your PYTHONPATH environment variable.

reflect swf/swc for class that implements interface in actionscript

Not sure if this is possible but I would like to reflect a swf or swc file selected by the user at runtime to find any classes that implement a certain interface. Can this be done or do you actually need a reference to the class you want to reflect using describeType();
Note - this would be done in actionscript.
Thanks,
You can inspect a swf for the classnames (Source) and then use describeType on them to find the ones which implement the interface(s). But this is probably slow. You can try to extend the getDefinitionNames code to get around the describeType and extract the needed info from the bytes...

automation errors in Flex Builder 3 when importing a swc from Flash CS 5

I am facing a really weird issue while trying to use an "swc" file imported from Flash CS5, that I am trying to use in Flex Builder 3 (by converting symbol to "Flex Component"). The errors are coming in files which are not even remotely related to the "swc" file that i am importing.
Now, I know that the automation stuff has come as a part of FB4, but I don't really have an option to migrate to FB4.
I have tried to change the flex sdk settings in Flash CS5 (steps given below), but that has not helped.
Edit-->Preferences-->Actionscript-->"Actionscript 3.0 Settings"-->"Flex SDK Path" (pointing this to flex3.5 sdk instead of Flex4.0 sdk)
I feel that the issue is most probably a compatibility issue b/w Flex 3 and Flex 4, but have not been able to find a workaround for the same. Any help is greatly appreciated.
Thanks,
Kapil
Here is the trace:
Severity and Description Path Resource Location Creation Time Id
1044: Interface method createAutomationIDPartWithRequiredProperties in namespace mx.automation:IAutomationObject not implemented by class com.sparsha.view.ui:SchematicWindow.
1044: Interface method createAutomationIDPartWithRequiredProperties in namespace mx.automation:IAutomationObject not implemented by class
1044: Interface method get automationEnabled in namespace mx.automation:IAutomationObject not implemented by class com.sparsha.lib.controls:CloseableTabBar.
1044: Interface method get automationEnabled in namespace mx.automation:IAutomationObject not implemented by class
1044: Interface method get automationEnabled in namespace mx.automation:IAutomationObject not implemented by class com.sparsha.lib.layouts:DockedAppLayout.
OK, first, the error: this means that Flash probably generated a class for the symbol you are importing using a certain template, where the template doesn't fit the SDK you are using to compile the project. Specifically, the generated class did not implement the methods listed in the error message. I.e. your framework.swc has a definition of mx.automation:IAutomationObject that has method createAutomationIDPartWithRequiredProperties() (nice name btw), but Flash generated code that reads as
package com.sparsha.view.ui {
import mx.automation:IAutomationObject;
public class SchematicWindow implements IAutomationObject { . . . } }
Since you cannot do anything about Flash not generating the method you need, your only way is to monkeypatch the SDK. I.e. copy the mx/automation/IAutomationObject.as from the SDK sources to the classpath of your project. Remove the conflicting method declaration (this may or may not result in other errors). If it results in further errors, repeat the same procedure for every class that "misbehaves"...
However, monkeypatching will mean that you are no longer able to use framework RSLs, as they will come with the original version. So, I would try to avoid the problem altogether and look for another way of exporting symbols from Flash IDE, for example, by not making them a Flex component. Or, if you really insist on them being a Flex component, then bootstrap the FlexSprite, for example, and assign your Flash symbols the bootstrapped class as the "parent class".
I was also having this problem recently. I would get the errors when I included the flash generated swc in my flex projects lib folder.
I was able to work around the issue by upgrading my flex to the flex 4.5.1.21328A SDK.
Additional Details about my project that might help others:
My swc was generated from Flash Professional CS5.5 and my Flex Project was being used in Flash Builder 4.5.
My swc was published to Flash Player 9 with ActionScript 3.0.
My flex project was using the 3.5.0.12683 SDK.