I’m creating application for android and IOS using FLASH CS5.5
I want to open pdf file when I click on the button. I try to use this code but is not working
package
{
import flash.html.HTMLLoader;
import flash.net.URLRequest;
import flash.display.NativeWindowInitOptions;
import flash.display.NativeWindowSystemChrome;
import flash.display.NativeWindowType;
import flash.display.NativeWindow;
import flash.events.Event;
import flash.display.SimpleButton;
public class bpdf extends SimpleButton
{
public function bpdf()
{
// constructor code
var htm:HTMLLoader= new HTMLLoader();
htm.load(new URLRequest("test.pdf"));
var init:NativeWindowInitOptions= new NativeWindowInitOptions();
init.systemChrome = NativeWindowSystemChrome.STANDARD;
init.type = NativeWindowType.NORMAL;
var win:NativeWindow = new NativeWindow(init);
win.stage.addChild(htm);
win.width = stage.stageWidth;
win.height = stage.stageHeight;
win.activate();
htm.width = win.width;
htm.height = win.height;
win.addEventListener(Event.CLOSE, onCloseEvent);
}
function onCloseEvent(e:Event)
{
trace("window closed");
}
}
}
after publishing with “PLYER: AIR FOR ANDROID” then I got these error message in output
[SWF] link2.swf - 2907 bytes after decompression
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at bpdf()[C:\Users\HP\Desktop\PDF Link\Link_2\bpdf.as:30]
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at runtime::ContentPlayer/loadInitialContent()
at runtime::ContentPlayer/playRawContent()
at runtime::ContentPlayer/playContent()
at runtime::AppRunner/run()
at ADLAppEntry/run()
at global/runtime::ADLEntry()
I also convert my file in APK and check in my android device but same problem when I click on the button, nothing happened
I make my APK file without include pdf and with include pdf
Include my pdf file using this way:: Publish setting > PLAYER: AIR FOR ANDROID – setting > Included files: test.pdf