flex - File() FileStream in web app -
i've made desktop app, , want work web app. errors on lines file() type , filestream, there way bypass ?
to piggyback on @florian f's correct response, here how might implement it:
create interface abstract file access
public interface igetthestuffservice { function getsometofu():tofu; }
create file-based implementation
public class filestuffservice implements igetthestuffservice { public function getsometofu():tofu { // file-based implementation } }
and http-based implementation
public class httpstuffservice implements igetthestuffservice { public function getsometofu():tofu { // http-based implementation } }
in consumer, rely on igetthestuffservice
[inject] public var tofuservice:igetthestuffservice; public function dosomestuff():void { var tofu:tofu = tofuservice.getsometofu(); // act on tofu }
notice inject meta tag. dependency injection (di) system push in dependency based on configuration (filestuffservice air apps or httpstuffservice web apps). parsley , robotlegs use [inject] fiex-ioc uses [iocbind]
of course, go without di container... inject parameter directly.
but idea... pretty simple pattern, actually.
Comments
Post a Comment