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;
Related
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 a plugin that I created and I want to use the WP rest api controller pattern in order to extend the api.
<?php
/**
* Plugin Name: myplugin
* Plugin URI: h...
* Description: A simple plugin ...
* Version: 0.1
* Author: Kamran ...
* Author ....
* License: GPL2
function myplugin_register_endpoints(){
require_once 'server/controllers/my_ctrl.php';
$items=new items();
$items->register_routes();
}
add_action('rest_api_init','myplugin_register_endpoints');
.
.
I created a class a folder called server/controllers and inside it my_ctrl.php file with a class that extends WP_REST_Controller that looks like this
// server/controllers/my_ctrl.php
class items extends WP_REST_Controller {
/**
* Register the routes for the objects of the controller.
*/
public function register_routes() {
.....
}
}
However I am receiving the following error in sublime xdebuge call stack:
[Fatal error] Class 'myplugin\WP_REST_Controller' not found
I am not sure how to solve this issue, where to put the files for my custom controller, where to create the instance of the custom class etc?
Stumbled upon this and thought I'd provide my solution in case someone else encounters this.
The idea is to postpone the instantiation of the class extending WP_REST_Controller by not instantiating it until the actual rest_api_init hook is called.
Code example:
add_action( 'rest_api_init', function () {
require_once(plugin_dir_path(__FILE__) . '/VideoImageApi.php');
VideoImageApi::instance()->register_routes();
});
Note the require_once from within the callback.
I have manged to solve the issue,
I checked the wp-content\plugins folder and I couldn't find the \rest-api folder and although I found the folder inside \wp-includes\rest-api it seems that this folder that integrates the "wp rest api" into core doesn't include all the classes that the api can expose (it includes only 3 php files), So it didn't include \wp-content\plugins\rest-api\lib\endpoints\class-wp-rest-controller.php . I installed the "wp rest api" plugin and it was added to wp-content\plugins and now I don't have the error anymore. (It was strange because I don't know when it was deleted from my project)
Thank you Dan your comments really helped me to recheck everything and scan the folders included in my wordpress and realize that the plugin is missing and that the folder \wp-includes\rest-api doesnt contain all the needed classes.
I've tried a number of applets out with my applet viewer and I keep getting the same response in the window, "Start: applet not Initialized". It doesn't matter how simple the program is, it compiles fine in Xcode, but it won't show up in the applet viewer nor in my browser. I've searched for answers to this problem, but it always turns out to be some error in the code of the questioner. I've tried many codes but none of them work. Here's the most simple example:
import java.awt.*;
import java.applet.*;
public class SimpleApplet extends Applet {
public void paint(Graphics g) {
g.drawString("A Simple Applet",20,20);
}
}
Here is the html:
<html>
<body>
<applet code="SimpleApplet" width=200 height=60>
</applet>
</body>
</html>
These are the error reports:
load: class SimpleApplet not found.
java.lang.ClassNotFoundException: SimpleApplet
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:210)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:144)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:695)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:723)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:652)
at sun.applet.AppletPanel.run(AppletPanel.java:326)
at java.lang.Thread.run(Thread.java:613)
What could be the problem?
Actually problem with the url of code in applet code (code="SimpleApplet") just run applet from program itself. Try
import java.awt.*;
import java.applet.*;
/*<applet code="SimpleApplet" width=500 height=500 ></applet>*/
public class SimpleApplet extends Applet {
public void paint(Graphics g) {
g.drawString("A Simple Applet",20,20);
}
}
I have an Adobe AIR ANE that builds and runs fine on iOS. I want to run this app in the AIR simulator, but with an actionscript version of the native ANE.
Reading the docs, it seems like a default profile would be perfect for this.
I added the default profile to the extension.xml file. I added a AS implementation of the native interface to every project in my workspace. I have made methods static/not static, etc. I have tried everything but I keep getting this error:
ArgumentError: Error #3500: The extension context does not have a method with the name
I am at a complete loss. Here are the relevant files:
extension.xml
<extension xmlns="http://ns.adobe.com/air/extension/3.1">
<id>com.novel.analytics.ext.ApsalarNativeInterface</id>
<versionNumber>0.0.0</versionNumber>
<platforms>
<platform name="iPhone-ARM">
<applicationDeployment>
<nativeLibrary>libApsalarNativeInterface.a</nativeLibrary>
<initializer>ExtInitializer</initializer>
<finalizer>ExtFinalizer</finalizer>
</applicationDeployment>
</platform>
<platform name="default">
<applicationDeployment/>
</platform>
</platforms>
</extension>
My AS implementation:
package com.novel.analytics.ext
{
public class ApsalarNativeInterface
{
public function ApsalarNativeInterface()
{
}
private static function initExtension():void
{
}
public function initApsalar(apiKey:String, secret:String):void
{
}
}
}
my native interface:
package com.novel.analytics
{
import flash.external.ExtensionContext;
public class ApsalarInterface
{
private static const EXTENSION_ID : String = "com.novel.analytics.ext.ApsalarNativeInterface";
private var context : ExtensionContext;
public function ApsalarInterface()
{
this.context = ExtensionContext.createExtensionContext(EXTENSION_ID, null);
}
public function initApsalar(apiKey:String, secret:String):void
{
context.call("initApsalar", apiKey, secret);
}
}
}
Here is my adt command line (library.swf is the lib that contains the two above files:
/Applications/Adobe\ Flash\ Builder\ 4.6/sdks/4.6.0/bin/adt -package -target ane ../../$PRODUCT_NAME.ane extension.xml -swc NativeInterface.swc -platform iPhone-ARM -C . library.swf -platform default -C . library.swf
Like I said, I am at a complete loss on this one.
Sorry for the much delayed response, but I think you'd benefit from checking out this wonderful tutorial:
http://www.digitalprimates.net/author/nweber/2012/04/10/building-a-native-extension-part-3/
Based on your code snippets above, it looks like you're trying to define your pure-ActionScript implementation in a different package, with a different classname. Seems you actually want to use the same package+class+method names and just store it in a different library (so it's bundled as its own SWF). Then you tell ADT how to bundle things.
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