I have some code that uses an ArrayCollection, it imports:
import mx.collections.ArrayCollection;
then:
static protected var myAC:ArrayCollection = new ArrayCollection();
Seems straightforward, but in my project the import (and thus ArrayCollection) are not found/defined!
I am using Flash Builder 4 (Flex 4) - it's an ActionScript project, and project properties is set to Flex SDK 4.0. Everything should be default settings.
When I type "import mx." and press control-space (autocomplete), I see a list of choices such as core, geom and several others, but no 'collections'.
I must be missing something?
By default, an "ActionScript Project" does not include the framework.swc which contains the flex packages such as mx.collections. If you really want to use ArrayCollection, you'll have add the swc and its corresponding resource bundle swc to your project library path. They are located at:
${FLEX_SDK_HOME}/frameworks/libs/framework.swc
${FLEX_SDK_HOME}/frameworks/locale/${locale}/framework_rb.swc
Export your project to zip
Update to FlashBuilder 4.1
Import your project from zip
Forget about your error)
Related
I am using FB 4.6 with SDK Flex 4.0A. I am trying to import and run an Actionscript (3) Project.
When I build the file, I get the error "1172: Definition mx.utils.ObjectUtil could not be found"
When I look in the Utils folder, there is no ObjectUtil.as file. Is this the problem?
ObjectUtil.as does not seem to be standard in the Util folder. https://code.google.com/p/as3corelib/source/browse/trunk/src/com/adobe/utils/?r=54
If you have pure ActionScript project it's normal that class from Flex SDK could not be found. Try to copy this class from SDK to your project. Also copy classes from list of imports if it's necessary.
ObjectUtil is a Flex class; you'll need to import this project as a Flex project rather than a pure Actionscript project.
Sorry, but it seems i cannot find any ConfigurationBuilder class in Twitter4j.
I'm using twitter4j version 3.0.3. I have already tried 3.0.2 android version too.
I have added the jar to build path like core, async, media, and stream.
I tried to :
- import twitter4j.*;
- import twitter4j.conf.*;
- import twitter4j.conf.ConfigurationBuilder;
But Eclipse says that :
Multiple markers at this line
- ConfigurationBuilder cannot be resolved to a
type
- ConfigurationBuilder cannot be resolved to a
type
What do i need?
I have already checked the source folders and there is a class named ConfigurationBuilder.java.
Thank you!
You have to make sure that Android Dependencies folder. To do that, you copy the twitter4j jar file to the libs folder and then right click to Configure Path and add the library.
After that's done, you will see that the library is also copied to the dependencies folder.
Right click on the project > Properties > Java Build Path > Libraries
Make sure that twitter4j-core-x.y.z.jar is really there
Go also to Order and Export tab in the same dialog
Make sure that the twitter4j-core-x.y.z.jar is selected (to get the jar distributed with the *.apk or else you will get something similar to the following at runtime: could not find class ConfigurationBuilder)
Project > Clean
Project > Build All
I have a custom component(eg. MyButton) used in several swfs. I'd like to share the component in runtime, thus once our designer change the button's visual effect, we need not publish all flas that uses this button.
In as2, I can put this button in an asset fla(eg. lib.swf) and check the "export for runtime share" in symbol property. Then copy the button to a fla(eg. main.swf) and check the "import for runtime share", this works fine. However in as3, after doing above, if I put a button instance on stage and modify its inspectable property, i'll get a compile error "1046:Type was not found or was not a compile-time constant".
I searched the web and found this http://www.kirupa.com/forum/showthread.php?317257-Runtime-Shared-Library-woes. Then I tried the swc approach, but it seems swc will be compiled into swf, it doesn't share at all.
the shared component must be put on the stage, because all fla will be modified by our designer while he knows nothing about programing.
we can not use flex, all operation must be done in Flash CS5.
1: Placed on Library all of your components to .fla as follows: my fla names BrushClip.fla the components wrapped a MovieClip. and be ActionScript Linking export to ActionScript Class.
2: File - Publish Settings check SWC format and publish as follows:
3: check, created swc file in your project. now you can using a swc other project you must linking to SWC library in File-ActionScript Settings-Library Path. and later if you change a components design, re-publish. and copy and paste swc file. automatically will change restart swf file. BrushClip.swc has a all components.
you can access as follows:
var brushClip0:MovieClip = new BrushClip0();
addChild(brushClip0);
var brushClip10:MovieClip = new BrushClip10();
addChild(brushClip10);
I've found the solution.
Give the Sprite that holds the imported components a binding class
Edit the class file, declare the components yourself regardless of whether checked the "auto declare instance on stage"
I've got an as3-robotlegs (signals) app that I want to run as a mobile project. I've discovered I can't have a pure as3 entry class ie.
this works fine for a Flash professional or pure as3 project
public class TestX extends Sprite
{
protected var context:ApplicationContext;
use namespace mx_internal;
public function TestX()
{
LoaderConfig.mx_internal::_url = loaderInfo.url;
LoaderConfig.mx_internal::_parameters = loaderInfo.parameters;
context = new ApplicationContext(this); <---
this.stage.nativeWindow.visible = true;
}
}
now for FlexMobile I need to do something like this in index.mxml
<fx:Declarations>
<context:SignalCafeContext contextView="{this}"/> <----
</fx:Declarations>
But do I really need to convert all my flash components to Flex UIComponent or is there a way I can use pure as3 (no mxml) in a FlexMobile project?
Thanks
Edit:
Took me a few days to churn through these great answers... all of them correct as I far as I can tell, I found amy's publishing arbitrary swfs works great, i found it easier to go with a pure actionscript mobile project
Command-line Adobe AIR Developer Tool (ADT) can package a SWF for mobile.
This way, any monolithic SWF created from various toolchains may be packaged for mobile.
Download AIR 3.5 SDK.
Assure JRE, or use the one from Flash Builder.
Execute adt to package your SWF to an IPA:
adt -package -target [ipa-test | ipa-debug | ipa-app-store | ipa-ad-hoc]
-keystore iosPrivateKey.p12 -storetype pkcs12 -storepass qwerty12
-provisioning-profile ios.mobileprovision
HelloWorld.ipa
HelloWorld-app.xml
HelloWorld.swf icons Default.png
Otherwise, Flash Builder 4.6 has pure ActionScript mobile projects:
Select File » New ActionScript Mobile Project
Although a Flex SDK is referenced for AIR, the project will be pure ActionScript.
Choose mobile settings.
Assure all references are merged in to code.
Which will stub your project as:
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
public class X extends Sprite
{
public function X()
{
super();
// support autoOrients
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
}
}
}
But do I really need to convert all my flash components to Flex
UIComponent or is there a way I can use pure as3 (no mxml) in a
FlexMobile project?
In Flash Builder 4.6 you can create an ActionScript Mobile project; which should do what you want. Creating a Flex Mobile project, assumes you will have dependencies on the Flex Framework and imposes some specific patterns on you, such as having your main application file be an MXML file that extends Application.
You can just take your swf and publish it for mobile, using these steps.
Create a new ActionScript Mobile Project and give it a name.
Go to Project -> Properties -> Builders.
Uncheck the “Flex” builder (but leave the “AIR application.xml Builder”)
Now copy your arbitrary swf (ie: myapp.swf) into the bin-debug folder.
Create an ActionScript class with the same name as the swf, (ie: myapp.as) in the default package space.
Right click on the myapp.as file and click on “Set as Default Application”
Now it will generate a myapp-app.xml, go and open and edit as you like.
Click on run configuration and package your app for you the platform you want.
Repeat steps to add more SWFs to package.
You can also find steps to go back and forth between Flash Pro and Flash Builder here.
I have a flash app built in ActionScript 3 utilizing a document class.
I have followed the documentation for implementing Omniture ActionSource tracking by adding the ActionSource component to my fla's library, and then importing it into the document class and running the configuration code. However, the app fails to compile because it cannot resolve the path to the component (com.omniture.ActionSource).
My class path contains a com directory (package) where most of the classes I use in my projects reside.
Has anyone had success implementing ActionSource in this manner?
Thanks
Alpinista - make sure you are importing the class in your DocumentClass
import com.omniture.ActionSource;
And make sure you are adding the ActionSource class to the project by either using the mxp feature:
Command Menu > Omniture - Add ActionSource to Library
OR
You can add the ActionSource SWC file to your publish setting if you have CS4 or later:
File > Publish Setting > Flash > Settings... button > Library Path Tab > Click (+) button > Click Red Envelope button > Select the SWC file, then hit okay.
If you still can't publish, then you probably forgetting something even more simple, or have a typeo/syntax error.