You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by kinjal patel <ki...@gmail.com> on 2016/03/08 12:37:28 UTC

Detect Device using FlexJS

Hello,

  How to detect device using FlexJS.This works fine in swf ouput but throw
error when i convert as/mxml to js/html using asjsc command.

Could not find file for class: flash.system.Capabilities
File not found: flash.system.Capabilities

java.lang.RuntimeException: Unable to find JavaScript filePath for class:
flash.
system.Capabilities
        at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDe
psWriter.java:176)
        at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDe
psWriter.java:210)
        at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.buildDB(GoogDe
psWriter.java:128)
        at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.getListOfFiles
(GoogDepsWriter.java:80)
        at
org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSPubli
sher.publish(MXMLFlexJSPublisher.java:330)
        at
org.apache.flex.compiler.clients.MXMLJSC.compile(MXMLJSC.java:467)
        at
org.apache.flex.compiler.clients.MXMLJSC._mainNoExit(MXMLJSC.java:346
)
        at
org.apache.flex.compiler.clients.MXMLJSC.mainNoExit(MXMLJSC.java:271)

        at
org.apache.flex.compiler.clients.MXMLJSC.staticMainNoExit(MXMLJSC.jav
a:230)
        at org.apache.flex.compiler.clients.MXMLJSC.main(MXMLJSC.java:176)

Thanks,
Kinjal



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Detect-Device-using-FlexJS-tp12145.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Detect Device using FlexJS

Posted by Alex Harui <ah...@adobe.com>.

On 3/8/16, 3:37 AM, "kinjal patel" <ki...@gmail.com> wrote:

>Hello,
>
>  How to detect device using FlexJS.

We don't have this in FlexJS yet.  Would you like to be the person to
write it?

>
>Could not find file for class: flash.system.Capabilities
>File not found: flash.system.Capabilities

I am hoping there will not be a need for any flash.*.* classes in a FlexJS
application so you can use "import flash." as a clue that your code still
has some Flash dependency.  Folks writing components will need to use
"import flash.*.* in order to implement an API against the Flash Player,
but application writers should be abstracted from Flash by FlexJS
components.

Regarding device detection and other things in flash.system.Capabiiities.
My current plan (and it doesn't have to be this way) is to create
org.apache.flex.utils.* classes to wrap up chunks of functionality from
Capabilities.  So there would some day be an I18nUtils.as in the Core
project in org/apache/flex/utils to wrap Capabilities.language, a
ScreenUtils.as to wrap up the screen properties, etc.  Would you like to
try writing DeviceUtils.as?

We'll be happy to help.

-Alex


Re: Detect Device using FlexJS

Posted by Peter Ent <pe...@adobe.com>.
I don't have a concrete answer for you off the top of my head, however, I
can give you some pointers.

flash.system.Capabilities should be enclosed within a COMPILE::AS3 { Š }
block since it should only appear in SWF output. That can either be an
entire class, function, or just a bunch of statements, however it suits
your needs.

For the JS side, there's probably a way via the browser or document or
something to determine device. You may have to go so far as using Cordova,
but as I said, I'm not 100% sure of the JS solution. However, when you do
find that solution you'll need to contain within a COMPILE::JS block so
that code only winds up in the translated JS output files.

Regards,
Peter Ent
Adobe Systems/Apache Flex Project

On 3/8/16, 6:37 AM, "kinjal patel" <ki...@gmail.com> wrote:

>Hello,
>
>  How to detect device using FlexJS.This works fine in swf ouput but throw
>error when i convert as/mxml to js/html using asjsc command.
>
>Could not find file for class: flash.system.Capabilities
>File not found: flash.system.Capabilities
>
>java.lang.RuntimeException: Unable to find JavaScript filePath for class:
>flash.
>system.Capabilities
>        at
>org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDe
>psWriter.java:176)
>        at
>org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDe
>psWriter.java:210)
>        at
>org.apache.flex.compiler.internal.graph.GoogDepsWriter.buildDB(GoogDe
>psWriter.java:128)
>        at
>org.apache.flex.compiler.internal.graph.GoogDepsWriter.getListOfFiles
>(GoogDepsWriter.java:80)
>        at
>org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSPubli
>sher.publish(MXMLFlexJSPublisher.java:330)
>        at
>org.apache.flex.compiler.clients.MXMLJSC.compile(MXMLJSC.java:467)
>        at
>org.apache.flex.compiler.clients.MXMLJSC._mainNoExit(MXMLJSC.java:346
>)
>        at
>org.apache.flex.compiler.clients.MXMLJSC.mainNoExit(MXMLJSC.java:271)
>
>        at
>org.apache.flex.compiler.clients.MXMLJSC.staticMainNoExit(MXMLJSC.jav
>a:230)
>        at org.apache.flex.compiler.clients.MXMLJSC.main(MXMLJSC.java:176)
>
>Thanks,
>Kinjal
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/Detect-Device-using-FlexJS-
>tp12145.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.