Help With Jquery/flash Integration, External Interface Class
(First, let me clarify that this is actually a Flash 8 issue...)
I'm trying to mimic the map/news interaction on this site http://www.hbs.edu/global/
My version thus far is at http://www.mbsnyder.com/tridea/. I'm using a jquery slideshow/cycle function to rotate through the news callouts on load, and I'm looking for a way to achieve the following:On load, initiate rotation of highlighted continents (Flash) that matches/syncs with their corresponding news callouts (jquery/html)Pause all cycling on hover/clickCreate play button to resume all cycling on click Any insight on how to do this with the external interface class would be helpful, as I am a newbie with its integration.
DevShed > Flash Help
Posted on: January 13th, 2009, 08:49 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
External Interface & Multiple Class Files
I'm still a bit wet behind the ears with AS3 & hoping someone can help out.
I'm trying to use external interface so that a javascript function can run on the page and tell my flash carousel to start playing a video.
I have a few class files though, there is the document class that builds all of the assets in the swf. Then another class that controls the video playback.
I'm wondering if I have to import the ExternalInterface at the document class level or if it can be within the video playback class (VidPlayer.as)?
I tried it from both but think I'm also missing something all together here.
As I encounter this error:
ReferenceError: Error #1065: Variable sPlayVideo is not defined.
at com.billboard.marquee::SWFLoader$cinit()
at global$init()
my code looks like this which is not within the doc class constructor function (but have moved it around to a few places to no avail):
private function sPlayVideo(){
//args
}
ExternalInterface.addCallback("autoPlayVideo",sPla yVideo);
Are there rules about where within the package def or class def that this can be called or referenced, or how it can be shared with other class files?
I read through the flash help files and some examples online and can get it working within a self contained test .swf but once I try to bring it into my whole project with multiple .as files it doesn't work....
thanks
External Interface Class Causes JavaScript Error In IE
I'd appreciate any help with this: I need to pass URL info from my pages to my movie. But when I use the External Interface class in AS2, Internet Explorer displays the page OK and runs the movie, but it won't run the JavaScript function that I'm calling and gives me a yellow triangle error of "flash is undefined" in Line 1.
I've tried publishing to the version 8 and version 9 player. And there is no error in Firefox, which runs my JavaScript and AS code just great. (Yeah, big surprise.) The AS code is fairly simple...
Attach Code
import flash.external.ExternalInterface;
var myURL:Object = ExternalInterface.call("whatDirIsThis");
switch (myURL) {
case "cats":
gotoAndPlay("meow");
break;
case "dogs":
gotoAndPlay("woof");
break;
default:
gotoAndStop("beginning");
break;
}
External Interface & Multiple Class Files -Help?
I'm still a bit wet behind the ears with AS3 & hoping someone can help out.
I'm trying to use external interface so that a javascript function can run on the page and tell my flash carousel to start playing a video.
I have a few class files though, there is the document class that builds all of the assets in the swf. Then another class that controls the video playback.
I'm wondering if I have to import the ExternalInterface at the document class level or if it can be within the video playback class (VidPlayer.as)?
I tried it from both but think I'm also missing something all together here.
As I encounter this error:
ReferenceError: Error #1065: Variable sPlayVideo is not defined.
at com.billboard.marquee::SWFLoader$cinit()
at global$init()
my code looks like this which is not within the doc class constructor function (but have moved it around to a few places to no avail):
private function sPlayVideo(){
//args
}
ExternalInterface.addCallback("autoPlayVideo",sPla yVideo);
Are there rules about where within the package def or class def that this can be called or referenced, or how it can be shared with other class files?
I read through the flash help files and some examples online and can get it working within a self contained test .swf but once I try to bring it into my whole project with multiple .as files it doesn't work....
thanks
Using External Interface Class To Test For Browser Javascript
Right now this is just a hypothetical question but it might be useful. I've started using the External Interface Class to communicate with external Javascript functions on my web page.
One of the built-in properties of External Interface is named " available ".
It's a Boolean property to check whether the Flash Player is in a container that has an external interface.
I'm curious if using this property is a way to test if the visitor's browser has Javascript enabled?
Thanks,
John
JQuery & Flash Interaction...
Hi all,
has anyone had any experience of getting javascript created using jQuery & flash to communicate with each other through the external interface?
I have no experience of JS or jquery but a client has built a site with it & PHP. On a page he has my flash app (a resizable graph with labels) & a multi-column table with information that pertains to the labels. When the label is clicked on the graph, the table needs to highlight/expand the relevant cell. When the table cell is clicked, the flash app needs to move to the relevant position.
In order to quote reasonably I need to know if this requires hand editing of the JS code created by jquery or is it much simpler? My understanding of these things pretty much stops at the external interface call.
Many thanks,
PMF
Flash CS3 Call JQuery?
Hi,
I am developing page for client who wanted Text floating over Flash.
So, I got the text floating using CSS. And, I have JQuery loading,
causing the Text to show, a link is clicked.
However, I don't know how to launch the Javascript from inside Flash,
when the correct frame loads.
Here is what I have right now (click the link to see how the Text is
supposed to load):
http://marcinpiasta.com/vivid/1/index.html
Here is the JQuery I am using right now:
Code:
function showHome() {
$('#samples').show(300);
$('#testimonials').show(300);
}
So, I need Flash to call showHome() when Frame 30 loads. How do
I do that?
Much appreciated,
Thanks
External Php Data/flash Integration Question
for a little project i'm working on i've been trying to come up with a way to store a variable relative to date with mysql and php and then have that variable loaded into flash to then be worked with through actionscripting.
to clarify a bit - im thinking that the database stores how long an object has been in the flash movie in certain increments (days for example) and then flash loads this data so that i could do something like if(days==3){ and go from there. this is being used for age so my end result will be if this is so and so days old, then it will do this. i know how to work with the variables inside flash but it's php that i have next to no knowledge on so any help is appreciated.
ive looked around here a bit and haven't seen any topics lately about this so i figured it'd be alright that i made my own topic.
[jQuery] With Flash Menu How Do I Link?
I have created a flash menu with the following ajax links in Actionscript
Code:
getURL("javascript:makeRequest('content.php?category=help', 'textContent')");
But now i like to use jQuery, but how do i translate this in Actionscript
Code:
$.get("content.php", { category: "help"}, function(data){
$("div#textContent").html(data);
} );
Class Or Interface 'flash.events.Event' Could Not Be Loaded.
What does this error message mean? how do I fix?
I coded a----- import flash.event.Event;
and I still got this message.
I've test the full coding by itself and it works fine. I add the module into an existing timeline frame, and I get the error.
error source= function playSound (e:Event) :void{
Full coding
import flash.events.Event;
function createAndPlaySound():Sound
{
function playSound (e:Event) :void{
s.removeEventListener(Event.COMPLETE, playSound);
s.play()
};
var s:Sound = new Sound(new URLRequest("fish.mp3"));
s.addEventListener(Event.COMPLETE, playSound);
return s;
}
var mySound:Sound = createAndPlaySound();
The Class Or Interface 'flash.utils.ByteArray' Could Not Be Loaded.
Hi all, I am trying to use some of the new functionality that is available in AS3 and I keep getting an unfathomable error message. The code that I am using is at the bottom of this post.
No matter what I do I keep getting the following error when I compile this code
The class or interface 'flash.utils.ByteArray' could not be loaded.
And the source line is
var pixels:ByteArray = srcBmp.getPixels( new Rectangle(0,0,imageWidth,imageHeight) );
Can anybody see what I am doing wrong here? This is driving me crazy!!
Attach Code
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.geom.Rectangle;
import flash.utils.ByteArray;
var imageWidth:uint = Elems.GroundMC.width;
var imageHeight:uint = Elems.GroundMC.height;
var srcBmp:BitmapData = new BitmapData( imageWidth, imageHeight );
srcBmp.draw( Elems.GroundMC );
var pixels:ByteArray = srcBmp.getPixels( new Rectangle(0,0,imageWidth,imageHeight) );
var copyBmp:BitmapData = new BitmapData( imageWidth, imageHeight, true );
Http Interface Loaded Into XML Class Fails On Web (but Works In Flash IDE)
Hello All,
I am trying to pull in some random numbers from www.random.org's http interface as shown here:
code:
var my_lv:XML = new XML();
var randomNumbers:Array = null;
my_lv.onLoad = function(success:Boolean) {
if (success) {
trace(unescape(this.toString())); // this prints out the 10 random numbers
_root.randomNumbers = this.toString().split("
");
} else {
trace("Error loading/parsing LoadVars.");
}
};
// load the 10 random numbers as specified here
my_lv.load("http://www.random.org/integers/?num=10&min=1&max=6&col=1&base=10&format=plain&rnd =new");
The problem is that, while this succeeds when "testing movie" from the flash IDE, it fails when the flash movie is accessed by users on the server. I thought this might be a sandbox security issue, so I whitelisted the www.random.org domain in my crossdomain.xml file, but it still doesn't work.
The relevant live doc is here: http://livedocs.adobe.com/flash/9.0/...=00002333.html
it says things like:
--------
Parameters
url:String - A string that represents the URL where the XML document to be loaded is located. If the SWF file that issues this call is running in a web browser, url must be in the same domain as the SWF file.
------------
I also came across the following paragraph on the net:
----
TIP: IMPORTANT!!! You can only load XML files if they reside on the same network as the Flash Movie. This means you can not link to an external XML feed such as a RSS Newsfeed (you may have heard of them being called blogs). There is a way around this. Either through Flash Remoting or through a Server Side Scripting Technology such as Microsoft's ASP/.NET, Java Server Pages, ColdFusion or PHP. These tools can be used to connect to external XML feeds which can then pass the content onto your Flash movie.
-----
I also tried System.security.allowDomain("www.random.org") which didn't work.
In the flash IDE the load.success evaluates as "true" and load.status evaluates as "0"
On the web load.success evaluates as "false" but the load.status strangely evaluates as "0" also
Anyone have any ideas? Thank you.
ActionScript 2.0 Class Scripts May Only Define Class Or Interface Constructs.
This is driving me nuts. I have an old AS1 project which I upgraded to AS2. It uses an include file, settings.as, which has stuff like this:
settings = new Object();
settings.property = 'some value';
Then I include it on the main timeline like this:
#include "settings.as"
Every time I render, I get a million and one Compile Errors stating:
"ActionScript 2.0 class scripts may only define class or interface constructs."
But it isn't an ActionScript 2.0 class! It's just a regular include. How do I avoid the bogus Compile Errors?
External Interface Help Flash To Java
I want to make when the user moves their mouse over a invisible button moves to the bottom of the screen; to reveal the rest of the page by using the javascript external interface in flash, but i dont know quite how to execute it.
heres the Java:
(I have set AllowScriptaccess="always" )
<script language="JavaScript">
function scrlDwn(){
window.scrollTo(0,690);}
</script>
heres what i tried doesn't work:
import flash.external.ExternalInterface;
invsblbtn.onRollOver(scrlDown);
function scrlDown():Void {
ExternalInterface.call("scrlDwn");
}
I also tried:
import flash.external.ExternalInterface;
invsblbtn.addEventListener("onRollOver", ScrlDown);
function ScrlDown() {
ExternalInterface.call("scrlDwn");
}
heres a tutorial but the heck if know how to make it work. http://www.communitymx.com/content/a...ge=2&cid=0922A
[CS3] Get Current Url To Flash Swf Using An External Interface Call
Hi all,
Hope someone will be able to help me with that. I have been coding for many years but I'm quite new to classes. All I want is to create a class that keep track of my swf url.
I now how to do that inside flash:
Code:
import flash.external.*;
var urlPath;
function geturlhttp() {
urlPath = ExternalInterface.call("window.location.href.toString");
trace("urlPath");
}
geturlhttp();
The class I created is not working. It keep displaying an error: "There is no method with the name 'ExternalInterface'."
Partial code below:
Code:
import flash.external.*;
class Tracker extends MovieClip {
private var domain:String;
public function urlPath():String {
return domain = ExternalInterface.call("window.location.href.toString");
}
public function recordEvent(eventName:String):Void {
var me = this;
var sendEvent = this.createEmptyMovieClip("sendEvent"+eventCount, eventCount);
var e = sendEvent.createEmptyMovieClip("e", 0);
eventCount++;
e.domain = urlPath();
sendEvent.onData = function () {
e.loadMovie(myURL, "POST");
}
}
Many thanks,
Nel
External Interface-Flash Player 10 Security
According to Adobe, flash player 10 need user initiated action for External Interface. To test this, I have written small code. While I run that HTML in firefox browser(Player 10) , both gets communicated with each other without user interaction. I don't know why?...But in IE , I got a same result as per Adobe statement.
Anyone help me why I'm getting in Firefox.
Attached src file.
Is There A Better User Interface For Flash When Using Dozens Of External .as Files?
hello;
when using 1 or many external .as files, I have to:
- open my main .fla
- browse for every external .as file that I am going to need for the particular project, and open them one at a time;
once they are all open, I have access to them via tabs at the top of my flash timeline, which is only wide enough for about 10 tabs, and the rest of the tabs are scrolled offscreen to the right or left;
is there a better way to work with external .as files?
Director uses a 'cast' to handle all of it's scripts, so you can have hundreds if need be, and they are all opened as you open this_project.dir, and they are all easily accessible;
thanks
Shannon
Addressing Flash Objects In Safari (external Interface)
hey actionscripters-
Working on a site that uses external interface to control the appearence of a number of buttons, setting color and text. The whole deal works fine in Firefox and IE (after vigorous debuggging), but I can't seem to address the objects correctly in safari. The swfs are hard coded in and I'm using a function to find the reference to the object and then using an EI addcallback to set the values.
Here some javascript for the main functions:
Code:
function getMovieName(movieName) {
if (window[movieName]) {
if (window[movieName].id != undefined){
//alert("explorer! window id: "+window[movieName].id);
return window[movieName];
} else {
//alert("safari! window id: "+x.id);
x = window[movieName];
return x;
}
}
else if (document[movieName]){
//alert("firefox! document id: "+document[movieName].id);
return document[movieName];
}
else {
alert("other");
}
}
function setSwfColor(){
var color = "<?php echo $skinColor; ?>";
var headerTxt = "<?php echo $headerTxt; ?>";
getMovieName("headerSwf").setBtn(color,headerTxt);
getMovieName("btnSwf1").setBtn(color,"Home",false,"index.php?page=home");
getMovieName("btnSwf2").setBtn(color,"Learn More",false,"index.php?page=learn");
getMovieName("btnSwf3").setBtn(color,"Why Turn Key?",false,"index.php?page=why");
getMovieName("btnSwf4").setBtn(color,"Who Is <?php echo $firstName; ?>?",false,"index.php?page=about");
getMovieName("btnSwf5").setBtn(color,"myBiz News",true,"index.php?page=news");
getMovieName("signUpSwf").setBtn(color);
//alert("header set");
getMovieName("arrowSwf").setBtn(color,"Take The Tour","<?php echo $mibLink;?>");
}
Here's an example of one of the flash objects:
Code:
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" WIDTH="764" HEIGHT="146" id="headerSwf">
<PARAM NAME=movie VALUE="<?php echo $baseHref; ?>flash/dynoHeader.swf">
<param name=’allowScriptAccess’ value=’always’/>
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
<EMBED src="<?php echo $baseHref; ?>flash/dynoHeader.swf" quality=high bgcolor=#FFFFFF WIDTH="764" HEIGHT="146" NAME="headerSwf" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" />
</OBJECT>
This is what I'm on currently but I've tried everything I can think of to reference the object in the safari fork of getMovieName (document.getElementById, window[movieName], etc) but no luck! Currently safari error consol reads "Value undefined (result of expression getMovieName("headerSwf").setBtn) is not object." I'm no javascript wizard, but I know enough to get by 95% of the time. What am I doing wrong here? Any help will be very much appreciated!
Loading External Video Streams Into Flash Interface - Options?
Hey guys,
Okay, here is the problem... I have created a flash interface which will load external video movies into it. I can load the video into it using .flv or .swf format (although I am told that .flv is a slightly better quality format). I create the streams that I require using Sorenson Squeeze into both broadband and dial-up streams. The broadband one looks great but the dial-up one is very pixilated (as you would expect due to the higher compression).
My question is, is it possible to add a preloader to an .flv? Or is it only possible to import the movie into flash, add the preloader then export it as a .swf? I am going to be making multiple versions of this interface for numerous companies so I am really looking for the least time-consuming option, yet retaining as much quality as I possibly can.
Thank you in advance.
Ian
[CS3] Flash Interface For Client To Control Play Order Of External Swfs
Hope someone can help. I am a newbie to Actionscript 3.0 but not to Flash but am learning fast and wondered whether anyone could explain the best route forward for this project.
My client has approx 12 different presentation .swf's all with a beginning, middle and an end (phew!). I need to build an interface that views those 12 individual presentations as thumbnails on a single page and allows my client to click and drag whichever ones they wish to use into a separate little container above and in-doing so create a new required running order (left to right) each time they use my interface... so that once they have decided that running order they can somehow use the result for their required presentation. They will be using this interface ongoing throughout the year for various presentations all that will require maybe just a few of those individual swf's in different orders.
Does that make sense?
Thanks!
Interface Class.
I have an interface class
public interface Ifoo;
i have another class that implements the interface class foo
public class foo implements Ifoo;
and I declare a variable of type Ifoo, within class foo or some other
var temp:Ifoo;
how do I use this variable? I don't get the concept of declaring a variable of type of an interface class. Please explain it to me.
[CS3] Class Or Interface Could Not Be Loaded
Hello.
I have a project that has been handed to me where a bunch of .as files need to load up for it to work. All do except one. The path is correct and case sensitivity has been triple checked. IT does not give me the error on the import line though, it gives it to me on the variable line. This is the code with the problem:
var menu = new Menu();
the Description is simply:
The class or interface 'com.vandalEyes.Menu' could not be loaded.
Again, this file structure is right on. Any clues?
I am an animator, not a programmer, but I know the basics (or I thought I did)
Thanks in advance!
-Poyla
The Class Or Interface Could Not Be Loaded.
This is my first day using actionscript 3.0.
i just downloaded and installed flash player 9 alpha actionscript 3.0 preview.
im trying to load an XML file
package
{
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.util.*;
class LoadXML extends Sprite {
public function LoadXML() {
var loader:URLLoader = new URLLoader( );
.
.
.
.
**Error**
LoadXML.as: Line 8: The class or interface 'Sprite' could not be loaded.
class LoadXML extends Sprite {
**Error**
Line 11: The class or interface 'URLLoader' could not be loaded.
var loader:URLLoader = new URLLoader( );
i was looking around and it doesnt even seem like i have the ... um library files ... um .as files for actionscript 3.0 objects, i can only find the files for actionscript 2.0 objects.
has anyone come across this before?
How To Make A Class Interface Global ?
I need to know if it is possible to make an interface global so it can be accessed from any level within a flash movie. You can set variables to global using the _global method but is it possible to do the same thing to an interface ? As an example of a interface the below interface is an example from the help section within Macromedia Flash.
interface MyInterface {
function method_1():Void;
function method_2(param:String):Boolean;
}
This is how you could declare a variable to be of the MyInterface type.
var newInterface:MyInterface = new MyClass();
MyClass is a class that implements the interface. newInterface is the variable to be of the MyInterface type.
How can I make the MyInterface variable global ?
Thank you.
The Class Or Interface 'VideoEvent' Could Not Be Loaded.
Hello,
I am not sure why I am receiving the error: The class or interface 'VideoEvent' could not be loaded.
Here is my script:
Code:
import fl.video.VideoEvent;
function showorhidetext(e:VideoEvent):void {
if(video.playing || video.paused) {
clickplay.visible = false;
}
else {
clickplay.visible = true;
}
}
video.addEventListener(VideoEvent.STATE_CHANGE, showorhidetext);
It looks to me like the VideoEvent class should be imported. Any suggestions?
Thanks!
The Class Or Interface 'MouseEvent' Could Not Be Loaded
I am creating a swf file that would get populated with images and text taken entirely from an XML file from the local folder. All i need to do now is manouver between the images using a click of a button. Say there are some images lined up one below the other and there would be a button on screen.. on click of which the focus has to shift from one image to the other. To achieve this functionality i have created a Movie Clip that would act as the BG for the Images to show that the image is in Focus. I check the current location of the Movie Clip on cick of the button and then set the next location of the Bg movie clip accordingly.
The Functionality of moving/changing coordinates of the movie clip on click of a button works fine when done separately in a new file, but when combined with the code where the XML gets parsed and the Imges are set on the UI, it gives me an error -- "The class or interface 'MouseEvent' could not be loaded"
I'm adding my code below
______________________________________________
RPNext_btn.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(event:MouseEvent):void {
trace("here");
var XCo = SwatchBGRght_MC.x;
var YCo = SwatchBGRght_MC.y;
trace("X coordinate::"+XCo);
trace("Y coordinate::"+YCo);
if(YCo==145){
//SwatchBGRght_MC.y = 282.2;
}
if(YCo==282.2){
//SwatchBGRght_MC.y = 419.4;
}
if(YCo==419.4){
//SwatchBGRght_MC.y = 145;
}
}
__________________________________
Cb Linked To Class And Not Loading On The.fla(Interface
my cb is linked to the following class. and it is placed on the fla.(Interface)
it traces to show that theXML is getting loaded properly . What can I do to put it on the interface?
Code:
package chromatic.load_files{
import fl.controls.ComboBox;
import flash.display.MovieClip;
import flash.events.Event;
import fl.data.DataProvider;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLRequest;
import fl.containers.UILoader;
import chromatic.load_files.UIImageComponent;
import chromatic.load_files.LoadXML;
import chromatic.load_files.LoadRequest;
public class CBMajorComponent extends MovieClip {
public var cbMajor:ComboBox=new ComboBox();
private var uiImageComponent:UIImageComponent;
private var loadXML:LoadXML=new LoadXML();
private var loadRequest:LoadRequest=new LoadRequest();
private var listURL:URLRequest=new URLRequest();
private var dataLoader:URLLoader=new URLLoader();
private var theXML:XML=new XML();
private var arrayFile:Array=new Array("load_assets/keylist.xml");
private var concatArray:Array=new Array("CMajor","GMajor","DMajor","AMajor","EMajor",
"BMajor","FSharpMajor","CSharpMajor","FMajor",
"BFlatMajor","EFlatMajor","AFlatMajor",
"DFlatMajor","GFlatMajor","CFlatMajor");
private var noSpace:String;
private var fileName:String;
private var evtIndex:Number=-1;
private var sel:Number=-1;
public function CBMajorComponent():void {
trace("in CBMajorComponent");
init();
}
private function init():void {
fileName=arrayFile[0];
setFileName(fileName);
setupComponent();
}
private function setupComponent():void {
trace("in cbmajor setup "+fileName);
cbMajor=new ComboBox();
dataLoader=loadRequest.setUpRequest(fileName);
dataLoader.addEventListener(Event.COMPLETE,dataLoaded);
cbMajor.setSize(200, 22);
cbMajor.prompt = "Select a Key";
cbMajor.editable=false;
cbMajor.rowCount=15;
cbMajor.width=110;
cbMajor.move(0,0);
addChild(cbMajor);
cbMajor.addEventListener(Event.CHANGE, selectedName);
cbMajor.addEventListener(Event.CHANGE,changeEvent);
}
private function dataLoaded(evt:Event):void {
theXML=loadXML.setUpXML(fileName);
theXML=XML(dataLoader.data);
for (var i:int; i<concatArray.length; i++) {
noSpace=concatArray[i];
trace(theXML.key[noSpace].keyName);
cbMajor.addItem({label:(theXML.key[noSpace].keyName)});
}
}
private function selectedName(evt:Event):void {
/*Combobox evt.target.selectedName cannot have spaces (as we have).So until
* I learn how to rid a string of spaces thus the var noSpace
*/
uiImageComponent=new UIImageComponent();
evtIndex=evt.target.selectedIndex;
noSpace=concatArray[evtIndex];
setNoSpace(noSpace);
uiImageComponent.setFileName(fileName);
uiImageComponent.setNoSpace(noSpace);
uiImageComponent;
}
public function changeEvent(evt:Event):void {
trace(" You selected a key");
}
public function setFileName(fileName):void {
this.fileName=fileName;
}
public function getFileName():String {
return fileName;
}
public function setNoSpace(noSpace):void {
this.noSpace=noSpace;
}
public function getNoSpace():String {
return noSpace;
}
}
}
The Class Or Interface 'Responder' Could Not Be Loaded.
hi everyone..i'm looking forward with the AMFPHP Tutorial 2..
i've go through all the steps...everything doing well until when it came into flash...it said that "The class or interface 'Responder' could not be loaded."
Any idea how to solve this problems?Got no clue at all
It also give this error on line 8 and 19:
A type identifier is expected after the ':'.
How To Get AS3 Talking To JQuery?
Hi everyone,
The code below does the following - when you click on next it goes to step 2 which replaces step 1. This works but the problem I have is when I add the anchor like "2" on a flash button it goes to an empty page. What I want to know is how can I add this JS code into my Flash AS3 file so when I click on the flash button next it goes to step 2 instead of an empty page?
Code:
<script src="js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
function loadnext(divout,divin){
$("." + divout).hide();
$("." + divin).fadeIn("slow");
}
</script>
.hide {
display:none;
}
<div style="position:relative;" class="1">
step1
<a class="next" onclick="loadnext(1,2);">Next</a>
</div>
<div class="hide 2" style="position:relative;">
step2
<a class="next" onclick="loadnext(2,3);">Next</a>
</div>
This is the AS3 that is on my flash
Code:
button:button1.addEventListener(MouseEvent.CLICK, myButtonFunction);
function myButtonFunction(event: MouseEvent) {
var request:URLRequest = new URLRequest("2");
navigateToURL(request, "_self");
}
URLRequest thinks 2 is a new page but it should just go to the jQuery anchor "2".
I have tried adding an anchor like <a name="2"> but for some reason it still couldn't find it..
Please can someone help?
Check If Objects's X Class Implements Interface Y
Hi
I have an object(myObject) which is an instance of a class (myClass), I would like to make sure that myClass implements a certain interface (myInterface).
In other words: I have to browse through an array of objects and invoke a certain method in the ones that have such method ( the method is listed in myInterface).
Thanks in advance
LeoBeer
The Class Or Interface 'SSliderClass.Button' Could Not Be Loaded
Hi,
I've been left with this flash drawing utility to finish. It all works pretty well, however when i compile into swf i get the following error.
Could anyone provide me with some advice?
**Error** Symbol=sprite 60 (SliderButtonSymbol2), layer=Dummy Layer,
frame=1:Line 1: The class or interface 'SSliderClass.Button' could not be loaded.
JQuery - Transparent Validation
So I've just built this small little jQuery validation system and thought I would share it. It's transparent in the sense that it is a system for testing validation. It doesn't do anything on detection, it just tells you. Features: Access in two ways (through function & selector)
Supports regex testing
Allows for length testing
Clean HTML
Simple and Extendable
Example:
HTML Code:
Name: <input type="text" name="username" rel="[5, 15]" />
Email: <input type="text" name="email" class="email" />
With this, the username field has to have a length between 5 and 15, and the email field is checked to be an email. Clean HTML, right? What about the Javascript? There's a few ways to use it but this is how I plan on using it:
Code:
$('form').submit(function() {
if($(this).find('input:invalid').length != 0) {
// Do extra stuff here (select invalid forms with $(this).find('input:invalid')
return false;
}
});
Source:
Code:
jQuery.validators = {
url: /^(ht|f)tp(s?)://[0-9a-zA-Z]([-.w]*[0-9a-zA-Z])*(:(0-9)*)*(/?)([a-zA-Z0-9-.?,'/\+&%$#_]*)?$/,
number: /^[-+]?[0-9]*.?[0-9]+([eE][-+]?[0-9]+)?$/,
string: /[a-zA-Z]+/,
email: /^([0-9a-zA-Z]([-.w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-w]*[0-9a-zA-Z].)+[a-zA-Z]{2,9})$/
}
jQuery.fn.validate = function() {
i = 0;
target = jQuery(this)[0];
if(/input/i.test(target.nodeName)) {
jQuery.each(jQuery.validators, function(x, y) {
if(jQuery(target).hasClass(x) && !y.test(jQuery(target).attr('value'))) {
i++;
}
});
} else { i++; }
if(jQuery(target).attr('rel') != undefined && /[.*]/.test(jQuery(target).attr('rel'))) {
params = jQuery(target).attr('rel').replace(/[/, '');
params = params.replace(/]/, '');
params = params.replace(/ /, '');
params = params.split(',');
length = jQuery(this).attr('value').length
if(params.length == 1 && length < params[0]) {
i++;
} else if(params.length == 2 && (length < params[0] || params[1] < length)) {
i++;
}
}
return (i == 0) ? true : false;
};
$.extend($.expr[':'], {
valid: "$(a).validate();",
invalid: "!$(a).validate();"
});
Class Or Interface Could Not Be Loaded Error On Standard Components
I am trying to learn how to use Event Listeners. I created a TextInput field on my screen. In action script I have:
var my_ti:TextInput;
var enterHandler:Object = new Object();
enterHandler.enter = function(e:Object):Void{
trace("entered field");
}
my_ti.addEventListener("enter", enterHandler);
When I test the movie, I receive the error:
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: The class or interface 'TextInput' could not be loaded.
var my_ti:TextInput;
Any tips on fixing this would be greatly appreciated. All references that I have found to this error message have to do with paths. Given that this is a standard component, I don't know why it would be failing or what path to add, if that is indeed the problem.
TIA
[JS, JQuery] Cost Estimation Calculator
I got very bored this evening looking at paperwork so I decided to hack together a simple cost calculator (time*rate) for project estimations to amuse myself... it actually turned out quite useful, but if anything it's just a nice little jQuery workout.
Demo
http://rayboyd.com/projects/011/index.html
Source
http://rayboyd.com/projects/011/javascripts/master.js
Can I Do This With External Interface?
In HTML I have a link that creates an overlay like in lightbox. Is their a way I can do that from a button in flash? Here is my code in HTML that creates and turns off the overlay:
Code:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>newCourse</title>
<script src="swfobject.js" type="text/javascript"></script>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
#bgholder {
background:url("images/bg.jpg") repeat-x;
}
.fader {
display:none;
position:absolute;
top:0;
left:0;
width:100%;
height: 100%;
background-color: #000;
z-index: 1001;
-moz-opacity: 0.8;
opacity: .80;
filter: alpha(opacity=80);
}
</style>
</head>
<body>
<div id="bgholder">
<div id="black" class="fader" onClick="document.getElementById('black').style.display='none';"></div>
<div align="center" id="player">
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("newCourse.swf", "vforum", "900", "370", "9", "#ffffff");
so.addParam("allowfullscreen", "true");
so.write("player");
// ]]>
</script>
</div>
<a href="javascript:void(0)" onClick="document.getElementById('black').style.display='block';">This link turns the overlay on.</a>
</div>
</body>
</html>
External Interface
Im alittle confused on how to use the new external interface correctly. Every tutorial uses a component (not what im using) and the minute I switch to my own MC or BTN it doesnt work correctly. I was really looking to translate some of my AS calls to JS, i thought it was supposed to be easier... so heres what i would like to translate:
Code:
my_btn.onPress=function(){
getURL ("javascript:move_xy(2)");
}
code that didnt work:
import flash.external.*;
Code:
alert_butn.onPress = function() {
ExternalInterface.call("move_xy(2)", );
};
Using External Interface
I've got the following code
Code:
import flash.external.ExternalInterface;
var myURL:Object = ExternalInterface.call("window.document.location.hash");
Now the part that says "window.document.location.hash"...how am I supposed to type that in order to get the actual document.location.hash? Thanks!
AS3 External Interface And Ie6 And 7
I can’t get ExternalInterface to work in ie 6 and 7 with as 3. I can call JavaScript functions from actionscript but al returnvalues are null and callbacks don’t work either. Al this works just fine with Firefox. I use the code from the examples on ExternalInterface. I have IE 6.0 and flash player. 9.0.45.0.
Anyone got any ideas?
External Interface With C++
I have a Flex swf in a C++ container and I want to be able to communicate between the swf and the container. Is this possible with external interface? Can I use setVariable and getVariable? Thanks
External Interface....
I'm not sure if I'm on the write track with this...when I test my movie and click the button to call the ExternalInterface, nothing happens...
Here's the JavaScript in my HTML Page:
HTML Code:
<script type="text/javascript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
And here is the AS I'm using to try to call that:
ActionScript Code:
function clickButton(event:MouseEvent):void
{
ExternalInterface.call("MM_openBrWindow(linksPage.html,Links,width=500,height=700)");
}
EDIT: Nevermind. Figured it out. I just need to put ' ' quote marks around each argument.
So the working code looks like this:
ActionScript Code:
ExternalInterface.call("MM_openBrWindow('linksPage.html','Links','width=500,height=700')");
HOWEVER, it does not work in IE7....anyone know how the fix for that??
External Interface?
myBtn_mc.onRelease = function()
{
$myURL = "http://www.somewebaddress.com";
getURL("http://www.somewebaddress.com/page.php");
getURL("javascript:launch(www.somewebaddress.com? myVar=$myURL)");
}
Above code could work in Flash 8. How do I do equivalent in AS3. Using
'URLRequest' and 'navigateToURL' I can set up event listener to do equivalent of getURL("http://www.somewebaddress.com/page.php");
Whats stumping me is doing the Flash 8 javascript call in
getURL("javascript:launch(www.somewebaddress.com?m yVar=$myURL)");
I can use FlashInterface, but no actionscript function is being called and I simply want to launch a page carrying myvariable to a script.
myVar=$myURL is being passed into a page with javascript similar to the following:
<script type="text/javascript" src="http://somewebaddress.com/webPage.php"></script>
Script worked perfectly in Flash 8 with correct method being invoked as in:
getURL("javascript:launch(www.somewebaddress.com? myVar=$myURL)");
So is there a way in AS3 to do similar javascript call as in the above line??
Very much appreciate any help with this.
Colm
External Interface
Hi,
I'm having trouble using external interface in IE7.
Basically in IE7 I get an error on the bottom of the page saying "error on page".
I read up on the problem here
http://www.actionscript.org/forums/s...+interface+ie7
.... but its a solution for if your swf is inside a form tag. Mine is not.
I also read up another possible solution here
http://livedocs.adobe.com/flash/9.0/...Interface.html
.... on this post there I 2 solutions that I got from it.
1 was to make sure that you set the id attribute of the object tag and the other was to add a delay to the java script function call in flash.
Neither if these solutions worked for me.
The swf is sitting on a aspx page
Has anybody got any other ideas???
External Interface
Hi Guys, I have a web site which is just one page. I am using tabs for this using CSS and Javascript. On one of the tabs I have the flvplayerPro and it is working quite nicely. However, I need to pause the player when I click off to another tab. I suspect I need to use JavaScript to trigger this having an if statement around this. This problem only seems to occur in IE browsers when I click to other tabs in Firefox & Opera the Player Stops.
var listenerObject:Object = new Object();
listenerObject.pause = function(eventObject:Object) {
//
};
myFlvPlayer.addEventListener("pause", listenerObject);
How do I constuct this?
Can you please help me with the proper JavaScript Syntac and the if statement syntac to pause the player when I click to another tab.
Thanks!
External Interface IE7
Are there any work arounds for getting the External Interface call / callback to work with IE7 and no IDs are set? Is it possible to set the ID from Flash after the SWF is loaded? I tried and it still doesn't seem to work with External Interface. Any detail on how External Interface actually interfaces to Javascript, something more than the simple documentation material on forums?
I'm in a situation where the ID is simply not set ahead of time before loading the SWF. I need to get External Interface working with IE and have been wracking my brain.
Thanks in advance for advice.
External Interface
Hi,
I'm having a problem when viewing my swf on MAC OSX specifically safari browser. The swf uses external interface and makes regular calls to javascript functions. It works perfectly on pc's but not on MAC OS X.
It seems flash is simply not following its own timing rules when (and only when) it is ALSO making frequent Javascript calls. I have tried using a differnt timing method, setInterval(), so not onEnterFrame, which fixed some problems but introduced more.
The problem is definitely related to the frequency of calls to Javascript. In swf's that don't call it, nothing goes wrong.
My guess at the time was that each Javascript call somehow 'releases'
the timer, advancing it directly to the next thing to do.
Has anyone come accross this problem before and no of a fix or has any ideas, i'm open to suggestions.
thanks in advance
Greg
External Interface Help
Hi, I have a pretty complex script but I have simplified the script so the problem is obvious.
I am using the externalInterface.addCallBack and this is my script
import flash.external.*;
keyboard.visible = false;
ExternalInterface.addCallback("callPlayBall", null,clickAdd);
function clickAdd(evt:Event):void {
keyboard.visible = true;
}
and this is the description of the problem from the complier.
1137: Incorrect number of arguments. Expected no more than 2.
External Interface With C++
I have a Flex swf in a C++ container and I want to be able to communicate between the swf and the container. Is this possible with external interface? Can I use setVariable and getVariable? Thanks
IE External Interface Bug
I've seen this bug described in a number of places online but so far no answers, so let me throw it out there again. I'm working on a page with a number of buttons whose color and text are set by an external interface function called setBtn(color,txt) which triggers an AS function jsinit(color,txt) via an addcallback. On page load a function is called which skins the buttons based on values passed into javascript from php (nonthing fancy). Now, all of this works fine in Firefox and PC safari but once you throw it into IE the javascript call myMovieRef.setBtn(mycolor,mytxt) fails, throwing the error "object doesn't support this property or method". No such error in other browsers. It's also worth noting that I have a call function in my AS that calls the javascript function flashsubmit, and this works just fine in all browsers, so I'm only having problems with addcallback. I'm working with IE6, my swfs are not in a form and they are hard coded into the page, which eliminates the two most common problems I've found relating to external interface. I tried delaying the javascript function to give the swfs time to load as has been suggested in other posts. No love. I have the object and embed tags labeled properly with id and name respectively and there are only alpha characters used, which is another common bug out there. I'm close to seppuku on this one, PLEASE HELP! Here's come code for ya. If you solve it and you live in Atlanta I'll buy you a beer. Otherwise I guess I could mail you one, but that would just be messy...
Javascript/Html snippet:
<script type="text/javascript">
var headerSwf;
var btnSwf1;
var btnSwf2;
var btnSwf3;
var btnSwf4;
var btnSwf5;
var signUpSwf;
var arrowSwf;
var leftWall;
var rightWall;
var ULcorner;
var URcorner;
var LLcorner;
var LRcorner;
var topWall;
var bottomWall;
function getObjRefs(){
if(navigator.appName.indexOf("Microsoft") != -1){
headerSwf = document.getElementById("headerSwf");
btnSwf1 = document.getElementById("btnSwf1");
btnSwf2 = document.getElementById("btnSwf2");
btnSwf3 = document.getElementById("btnSwf3");
btnSwf4 = document.getElementById("btnSwf4");
btnSwf5 = document.getElementById("btnSwf5");
signUpSwf = document.getElementById("signUpSwf");
arrowSwf = document.getElementById("arrowSwf");
}else{
headerSwf = document.headerSwf;
btnSwf1 = document.btnSwf1;
btnSwf2 = document.btnSwf2;
btnSwf3 = document.btnSwf3;
btnSwf4 = document.btnSwf4;
btnSwf5 = document.btnSwf5;
signUpSwf = document.signUpSwf;
arrowSwf = document.arrowSwf;
}
}
function setSwfColor(){
var color = "<?php echo $skinColor; ?>";
var headerTxt = "<?php echo $headerTxt; ?>";
headerSwf.setBtn(color,headerTxt);
btnSwf1.setBtn(color,"Home",false,"index.php?page= home");
btnSwf2.setBtn(color,"Learn More",false,"index.php?page=learn");
btnSwf3.setBtn(color,"Why Turn Key?",false,"index.php?page=why");
btnSwf4.setBtn(color,"Who Is <?php echo $firstName; ?>?",false,"index.php?page=about");
btnSwf5.setBtn(color,"myBiz News",true,"index.php?page=news");
signUpSwf.setBtn(color);
arrowSwf.setBtn(color,"Take The Tour","<?php echo $mibLink;?>");
}
function setHtmlColor(){
var color = "<?php echo $skinColor; ?>";
document.body.style.backgroundColor="#<?php echo $skinBgColor; ?>";
document.getElementById("leftWall").style.backgrou ndImage="url(<?php echo $baseHref; ?>images/"+color+"Left.gif)";
document.getElementById("rightWall").style.backgro undImage="url(<?php echo $baseHref; ?>images/"+color+"Right.gif)";
document.getElementById("ULcorner").src="<?php echo $baseHref; ?>images/"+color+"ULcorner.gif";
document.getElementById("URcorner").src="<?php echo $baseHref; ?>images/"+color+"URcorner.gif";
document.getElementById("LLcorner").src="<?php echo $baseHref; ?>images/"+color+"LLcorner.gif";
document.getElementById("LRcorner").src="<?php echo $baseHref; ?>images/"+color+"LRcorner.gif";
document.getElementById("topWall").src="<?php echo $baseHref; ?>images/"+color+"Top.gif";
document.getElementById("bottomWall").src="<?php echo $baseHref; ?>images/"+color+"Bottom.gif";
}
function skinPage(){
setHtmlColor();
getObjRefs();
setSwfColor();
}
function flashSubmit(email){
document.getElementById("weberName").value = "Test User";
document.getElementById("weberEmail").value = email;
document.getElementById("aWeberForm").submit();
}
</script>
</head>
<body onload='skinPage();'>
<div id="root">
<div class="header" id="headerDiv">
<OBJECT classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" WIDTH="764" HEIGHT="146" id="headerSwf"><PARAM NAME=movie VALUE="<?php echo $baseHref; ?>flash/dynoHeader.swf"><param name=’allowScriptAccess’ value=’always’/><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="<?php echo $baseHref; ?>flash/dynoHeader.swf" quality=high bgcolor=#FFFFFF WIDTH="764" HEIGHT="146" NAME="headerSwf" ALIGN="" TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>
</div>
Actionscript:
function jsInit(color,txt){
setColor(color);
setText(txt);
}
ExternalInterface.addCallback("setBtn",this,jsInit );
|