You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Justin Mclean <ju...@classsoftware.com> on 2017/03/01 05:42:28 UTC

[FlexJS] How to download files

Hi,

In AS you normally use URLRequest / FileReference to download a file, in JS you use window.open or window.href =.

Is there anything in FlexJS that will compile / work for both? I was unable to find anything or get anything working.

Thanks,
Justin

Re: [FlexJS] How to download files

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

On 2/28/17, 11:51 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:

>Hi,
>
>>> Having a document somewhere listing what is implement and what isn’t
>>> would be useful I think rather than having to hunt through examples /
>>> mailing list etc etc.
>> 
>> There is ASDoc [1][2].
>
>ASDocs are the API docs so I’m not 100% sure this would be the best place
>to document this or where documentation unreleased to a class would go.

There's also the beginnings of Tour De FlexJS.  Volunteers are needed
there as well.  If you have a better idea of where to document it, go for
it.

IMO, we want ASDoc and Tour to have some search feature so you could type
in "Download" and see some offerings.  IMO, if a class does downloading,
it should mention that, so it wouldn't be unrelated to the class.

Also, if you want to package up your code into a component with the name
Download in it, that might help as well.

FlexJS is still a beta.  We need more contributors, but those contributors
will have to be pioneers for the short term, willing to work on the
bleeding edge.  In US history, the first pioneers heading west from the
more developed eastern US followed roads to St Louis where they then had
to cross wide fields of grasslands with almost no trail features to
navigate by.  Later, other pioneers could follow the wagon wheel ruts of
the first pioneers and read accounts from those prior travelers.  Each
year, it got a little easier.  Only now are there paved roads, highway
signs, Trip Advisor.   Documentation will get better over time.  Faster if
more volunteers pitch in.  Flex had 8 years with a lot more people to pave
the roads, make the signs, etc just like the eastern US in the early
1800's.  We are blazing a new trail west from there into JS land.  We've
only had about 5 years with many fewer people.

My 2 cents,
-Alex


Re: [FlexJS] How to download files

Posted by ju...@classsoftware.com.
Hi,

"unrelated to a class would go" I mean.

Thanks,
Justin

Re: [FlexJS] How to download files

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

>> Having a document somewhere listing what is implement and what isn’t
>> would be useful I think rather than having to hunt through examples /
>> mailing list etc etc.
> 
> There is ASDoc [1][2]. 

ASDocs are the API docs so I’m not 100% sure this would be the best place to document this or where documentation unreleased to a class would go.

Thanks,
Justin

Re: [FlexJS] How to download files

Posted by Justin Mclean <ju...@classsoftware.com>.
HI,

> I believe there's an "A" component.  Would that work?

Thanks I didn’t consider that. Don't think it will work in this particular case but would in others.

I ended up adding this to my pom file:

<dependency>
   <groupId>org.apache.flex.flexjs.typedefs</groupId>
   <artifactId>flexjs-typedefs-js</artifactId>
   <version>0.8.0-SNAPSHOT</version>
   <type>swc</type>
   <classifier>typedefs</classifier>
   <scope>runtime</scope>
</dependency>

And just using window.open().

Note the classifier and scope in teh dependancy above, if you don’t put that in you get all sorts of errors. Hopefully that will save someone else some time.

Thanks,
Justin

Re: [FlexJS] How to download files

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

On 2/28/17, 10:40 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:

>Hi,
>
>> I don’t think we yet have anything which wraps File APIs. It’s probably
>>pretty straight-forward to build off URLBinaryLoader to get what you
>>need.
>
>Thanks for that. So just to confirm there’s nothing in FlexJS currently
>which will allow a user to download a file to their hard disk.

I believe there's an "A" component.  Would that work?

>
>Having a document somewhere listing what is implement and what isn’t
>would be useful I think rather than having to hunt through examples /
>mailing list etc etc.

There is ASDoc [1][2].  Volunteers are needed to make it better.  [2] is
currently broken, but is a FlexJS app for ASDoc.

[1] 
http://apacheflexbuild.cloudapp.net:8080/job/flex-asjs/lastSuccessfulBuild/
artifact/out/asdoc/index.html
[2] 
http://apacheflexbuild.cloudapp.net:8080/job/FlexJS%20ASDoc%20Example/lastS
uccessfulBuild/artifact/examples/flexjs/ASDoc/bin/js-debug/index.html

-Alex


Re: [FlexJS] How to download files

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> I don’t think we yet have anything which wraps File APIs. It’s probably pretty straight-forward to build off URLBinaryLoader to get what you need.

Thanks for that. So just to confirm there’s nothing in FlexJS currently which will allow a user to download a file to their hard disk.

Having a document somewhere listing what is implement and what isn’t would be useful I think rather than having to hunt through examples / mailing list etc etc.

I’m unlikely to use URLBinaryLoader as I only need to get this working on the JS side and just want window.open() (or the equiv) to work.

Thanks,
Justin

Re: [FlexJS] How to download files

Posted by Harbs <ha...@gmail.com>.
We have URLBinaryLoader for getting BinaryData.

I don’t think we yet have anything which wraps File APIs. It’s probably pretty straight-forward to build off URLBinaryLoader to get what you need.

DAYG… ;-)

Harbs

> On Mar 1, 2017, at 7:42 AM, Justin Mclean <ju...@classsoftware.com> wrote:
> 
> Hi,
> 
> In AS you normally use URLRequest / FileReference to download a file, in JS you use window.open or window.href =.
> 
> Is there anything in FlexJS that will compile / work for both? I was unable to find anything or get anything working.
> 
> Thanks,
> Justin