• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Using project libraries for both web-based and AIR applications

Explorer ,
Oct 04, 2011 Oct 04, 2011

Copy link to clipboard

Copied

I need to develop substantial code to build both web-based and AIR applications.  Yes, they will have different features, especially when it comes to accessing files on the local file system.

However, 98% of the code can be shared.

I want to use a project library that can be used for both types of applications. Maybe using conditional compile when required to not use AIR API's in a web-based application.

I found this (somewhat old) warning:

Include Adobe AIR libraries Select this option if your library must use AIR features, such as access to the AIR APIs. Flex Builder then changes the library path of this new Flex Library project so that it includes airglobal.swc and airframework.swc. Web-based Flex projects cannot use this library.

Do not select this option if you are writing a generic library intended to be used only in a web-based Flex application, or in either a web-based or AIR-based application.

Does this apply to Flash Builder 4.5?

Views

395

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 06, 2011 Oct 06, 2011

Copy link to clipboard

Copied

LATEST

I have found a workaround, but it's quite clumsy, involving a transfer vector (in old-fashioned terms) in the main application for each function in the AIR library.

I have created a library for AIR classes only (fourdtext.fileOperations is there). 

The AIR application provides "Function" values that any other code in the general-purpose libraries can use.

It works, but it's nasty.

In Main.mxml:

import com.fourdtext.fileOperations.AxFiles;

// this gets a list of native path strings, from and array of "File" objects

public var AxGetListFunction:Function = AxGetListRedirect;

private function AxGetListRedirect(list:Array):Vector.<String>{

    return AxFiles.AxGetList(list);

}

In general-purpose code:

var list:Array = event.dragSource.dataForFormat("air:file list") as Array;

...

var AxGetList:Function = FlexGlobals.topLevelApplication.AxGetListFunction;

listFiles = AxGetList(list);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines