All,
I have been trying to import some sample actionscript package into my flash project.
The sample code is defined in the org.red5.flash.bwcheck package.
In my flash project's (flash 8 and actionscript 2.0) actions frame:
I added these lines at the beginning:
import org.red5.flash.bwcheck.app.*;
import org.red5.flash.bwcheck.events.*;
import org.red5.flash.bwcheck.*;
and add the call to this package in my code
function start()
{
serverURL = settingsManager.getIP();
serverApplication = "live";
clientServerService = "checkBandwidthUp";
serverClientService = "checkBandwidth";
trace("calling connect()");
connect();
}
The connect() is a function defined org.red5.flash.bwcheck.app.BandwidthDetectionApp.
Nothing happens when I test the movie.
I added these paths to both action script 2.0's settings and project preferences:
./org/red5/flash/bwcheck
./org/red5/flash/bwcheck/app
./org/red5/flash/bwcheck/events
when I test or debug movie, the connect() does not seem to be called.
If I called the connect with the full path name:
Then I got a lot of syntax errors about the sample code which should not have errors.
My question is how do I import package and use it in my Actions Frame?
Thanks,
Peter
Related
I want to use Fleks ECS as shown in this example:
https://github.com/korlibs/korge-next/tree/main/samples/fleks-ecs
How to setup my KorGE project to be able to import the Fleks library?
I found that there is a built in function to import the Fleks into KorGE project.
Just configure the build.gradle.kts file as in the example below:
...
korge {
id = "com.example.mygame"
name = "My Game"
supportFleks()
targetJvm()
targetJs()
targetDesktop()
targetIos()
targetAndroidIndirect() // targetAndroidDirect()
}
Our iOS app is live in iTunes, and we want to integrate it with Branch io. We can build the ipa for testing, but when we try to "Export Release Build", the Flash Builder 4.6 will hang.
This is the branch io guide that we are following:
https://dev.branch.io/getting-started/sdk-integration-guide/guide/adobe/
We just followed the steps, and put in the stuff up to step 4, where we called
branch.init() in the main class. The setting in branch io is setup ok.
here are the codes, (just copied from branch io's website)
// Then create a Branch instance:
var branch:Branch = new Branch();
// Register two events before initializing the SDK:
branch.addEventListener(BranchEvent.INIT_FAILED, initFailed);
branch.addEventListener(BranchEvent.INIT_SUCCESSED, initSuccessed);
private function initFailed(bEvt:BranchEvent):void {
trace("BranchEvent.INIT_FAILED", bEvt.informations);
}
private function initSuccessed(bEvt:BranchEvent):void {
trace("BranchEvent.INIT_SUCCESSED", bEvt.informations);
// params are the deep linked params associated with the link that the user clicked before showing up
// params will be empty if no data found
var referringParams:Object = JSON.parse(bEvt.informations);
//trace(referringParams.user);
}
// Initialize the SDK:
branch.init();
Any clues?
I'm facing an issue when I try to bundle Aurelia-hammer with the CLI.
The app still keeps pulling hammer-swipe.js, hammer-tap.js,... from the node_modules folder.
When I inspect the plugin's AMD structure, these are defined as global resources:
function configure(frameworkConfig) {
frameworkConfig.globalResources('./hammer-swipe');
frameworkConfig.globalResources('./hammer-tap');
frameworkConfig.globalResources('./hammer-press');
frameworkConfig.globalResources('./hammer-hold');}
Is there any way to bundle these with the CLI? I tried adding these files to the "resources" element in aurelia.json without success.
the plugin author should export those classes: (HammerPressCustomAttribute...) so they could be traced properly. But you can dummy-import theme yourself as a workaround:
import { HammerPressCustomAttribute } from 'aurelia-hammer/hammer-press';
import { HammerSwipeCustomAttribute } from 'aurelia-hammer/hammer-swipe';
import { HammerTapeCustomAttribute } from 'aurelia-hammer/hammer-tap';
normally you have to do this as well:
import { HammerHoldCustomAttribute } from 'aurelia-hammer/hammer-hold';
but the class exported from hammer-hold.js is named HammerPressCustomAttribute (oops looks like copy-paste issue) so just reference the file even with a non existent class.
import { HammerHoldCustomAttribute } from 'aurelia-hammer/hammer-hold';
this should fix your problem (I hope). It's best to open an issue in the plugin repo and ask the author to export those classes (and rename the duplicate one).
I have some PDF files that I need to display in an Aurelia View.
The files are not available by direct link
I have an API function that returns a byte array.
In ASP.Net, I have some control over the response object's headers and content type, and can BinaryWrite the contents into the response.
I can't figure out how to do this in Aurelia.
Any suggestions?
Edit:
I'm attempting to use pdf.js as suggested. Injection in Aurelia fails.
import {inject} from "aurelia-framework";
import {HttpClient} from "aurelia-fetch-client";
import {PDF} from "pdfjs-dist"
#inject(Router, HttpClient, PDF)
export class PDFView {
constructor(router, http, pdf) {
this.router = router;
this.http = http;
this.pdf = pdf;
}
The console displays this error:
Inner Error:
Message: key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?
Inner Error Stack:
Error: key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?
at Container.get (http://localhost:65397/jspm_packages/npm/aurelia-dependency-injection#1.0.0-beta.1.2.3/aurelia-dependency-injection.js:480:15)
at Object.invoke (http://localhost:65397/jspm_packages/npm/aurelia-dependency-injection#1.0.0-beta.1.2.3/aurelia-dependency-injection.js:341:81)
at InvocationHandler.invoke (http://localhost:65397/jspm_packages/npm/aurelia-dependency-injection#1.0.0-beta.1.2.3/aurelia-dependency-injection.js:300:168)
at Container.invoke (http://localhost:65397/jspm_packages/npm/aurelia-dependency-injection#1.0.0-beta.1.2.3/aurelia-dependency-injection.js:564:25)
at StrategyResolver.get (http://localhost:65397/jspm_packages/npm/aurelia-dependency-injection#1.0.0-beta.1.2.3/aurelia-dependency-injection.js:127:37)
at Container.get (http://localhost:65397/jspm_packages/npm/aurelia-dependency-injection#1.0.0-beta.1.2.3/aurelia-dependency-injection.js:501:23)
at eval (http://localhost:65397/jspm_packages/npm/aurelia-templating#1.0.0-beta.1.2.7/aurelia-templating.js:3925:73)
End Inner Error Stack
------------------------------------------------
The import statement must be failing, yet pdfjs appears to load successfully as I receive status 200 for both pdfjs-dist#1.5.294.js and pdfjs when the page loads.
I can find no samples of Aurelia / pdfjs apps.
Repeating: I need to embed the stream as the PDF is not available via HTTP.
I'm not sure where to go from here
As far as I know there is nothing Aurelia-specific about loading pdf files.
You can use pdf.js. It has method getDocument that accepts binary data stored in byte array.
Then you can place a canvas inside your view, load pdf data during view activation and render pages into it using pdf.js after html is attached. For example code check answer by toddmo for this post: Pdf.js and viewer.js. Pass a stream or blob to the viewer
I've been following some tutorials and they use the function getTimer() in the actionscript code, but when I use it, it gives me: 1180: Call to a possibly undefined method getTimer.
I'm using Flash Builder 4.5 for PHP and Flash CS5.5.
The settings for my FLA file are set at Player v9 and ActionScript 3.0
I'm calling the funcion in this class:
package main.tutorials.ch1
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
public class CollisionTest extends Sprite
{
....
public function CollisionTest()
{
....
trace(getTimer());
}
}
}
I don't think it's the imports..
It's probably a missing library in Flash Builder, but I'm new and I don't know where or which library would be missing.
I also changed it to extends MovieClip but it still won't work.
Googling, i found the following:
http://www.actionscript.org/forums/showthread.php3?t=158893
It says you should add the following import.
import flash.utils.getTimer;