ExternalInterface issue in as3
Iam calling some JavaScript function with ExternalInterface in as3. That java script function set flashObj.SetVariable("userName", userName) .Icant get userName value but it is working in as2
show your ei related code and your called javascript function.
Similar Messages
-
Hi,
I am trying to implement a simple image gallery with alpha transition using as3. But an issue is occuring with this. After each image alpha transition, the stage becomes blank. The code i have used for image Gallery is following.CAn anybody help me. I am trying this for a week. but still i have a hope for make this working. So please help me.
import flash.display.Loader;
import flash.display.*;
import gs.TweenLite;
const TIMER_DELAY = 2000;
var totImages:Number;
var index:Number = 0;
var imgArr:Array = new Array();
var currentContainer:MovieClip = holder0;
currentContainer.alpha = 0;
var transTimer:Timer = new Timer(TIMER_DELAY);
//transTimer.addEventListener(TimerEvent.TIMER, startTransition);
var imgLoader:Loader = new Loader();
var myXML:XML = new XML();
var XML_URL:String = "images.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(event:Event):void{
myXML = XML(myLoader.data);
processXML(myXML);
function processXML(xml){
totImages = xml.children().length();
for(var i=0;i<totImages;i++){
var tempVar = xml..item[i]..image;
imgArr.push(tempVar);
//transTimer.start();
currentContainer = holder0;
loadImage();
function loadImage(){
var url = imgArr[index];
//ImgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressStatus);
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, fadeInImg);
var fileRequest:URLRequest = new URLRequest(url);
imgLoader.load(fileRequest);
currentContainer.addChild(imgLoader);
function fadeInImg(e:Event){
TweenLite.to(currentContainer,3,{alpha:1,delay:2,onComplete:switchClip});
function switchClip(){
if(index < totImages){
index++;
} else {
index = 0;
if(currentContainer == holder0){
currentContainer = holder1;
} else {
currentContainer = holder0;
currentContainer.alpha = 0;
MovieClip(this.root).swapChildren(holder0, holder1);
loadImage();
Thanks and Regards,
SreelashHi Adrei, I have implemented the thumbnail button also. Its working but the problem is that thumbnail buttons and controls are placing behind the image container. How can i place the thumbnail buttons and control buttons over the image. You can view the result in the following url:
http://www.creative-showcase.co.uk/BirdStudiosOld/Videos/test/scrllGallAnd.html
The working swf is with the following url:
http://www.creative-showcase.co.uk/BirdStudiosOld/Videos/test/scrllGall.html
The code that i used for creating thumbnail is following
import flash.display.DisplayObject;
import flash.display.*;
import flash.display.Loader;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.text.*;
import flash.net.*;
import flash.utils.Timer;
import gs.TweenLite;
import gs.easing.*;
var xmlURL:String = "http://www.creative-showcase.co.uk/BirdStudiosOld/Videos/test1/images.xml";
var loadedImages:Array = [];
var imageURLs:Array = [];
var thumbArr:Array = [];
var imageLoader:Loader;
var prevImage:DisplayObject;
var currentImage:DisplayObject;
var thumbContainer:MovieClip;
var currThumb:MovieClip;
var prevThumb:MovieClip = null;
var showTimer:Timer;
var timerDuration:int = 5000;
var tweenDuration:int = 2;
var currentIndex:int = 0;
var activIndx:Number = 0;
var slidesHolder:Sprite;
var prvFlag:Boolean = false;
var nxtFlag:Boolean = false;
var twnFlag:Boolean = false;
var rt_lt_Flag:Boolean = true;
var myXMLURL:URLRequest = new URLRequest(xmlURL);
var xmlLoader:URLLoader = new URLLoader(myXMLURL);
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
xmlLoader.load(myXMLURL);
var a:int = 90;
ctrlBox.btnPlay.buttonMode = true;
ctrlBox.nextImg.buttonMode = true;
ctrlBox.prevBtn.buttonMode = true;
ctrlBox.btnPause.buttonMode = true;
ctrlBox.btnPlay.visible = false;
ctrlBox.btnPause.addEventListener(MouseEvent.CLICK,stopScroll);
ctrlBox.btnPlay.addEventListener(MouseEvent.CLICK,startScroll);
ctrlBox.nextImg.addEventListener(MouseEvent.CLICK,shwNext);
ctrlBox.prevBtn.addEventListener(MouseEvent.CLICK,shwPrev);
function xmlLoaded(e:Event):void {
var a:int = 45;
e.target.removeEventListener(Event.COMPLETE, xmlLoaded);
processXML(XML(e.target.data));
function processXML(xml:XML):void {
var len:int = xml.children().length();
var tempVar:String;
for (var i:int = 0; i < len; i++) {
tempVar = "http://www.creative-showcase.co.uk/BirdStudiosOld/Videos/test1/" + xml..item[i]..image;
//trace(tempVar)
imageURLs.push(tempVar);
preload();
createThumbs();
function createThumbs():void{
thumbContainer = new MovieClip();
addChild(thumbContainer);
for(var i:int=0;i<9;i++){
var thmbHolder:MovieClip = new MovieClip();
thumbContainer.addChild(thmbHolder);
//MovieClip(this.root).swapChildren(currentImage, ctrlBox);
thmbHolder.buttonMode = true;
var thmb:thumbClass = new thumbClass();
thmbHolder.addChild(thmb);
thumbArr.push(thmbHolder);
thmbHolder.name = i.toString();
thmb.imgNum.text = (i+1).toString();
thmbHolder.addEventListener(MouseEvent.CLICK,showImage)
//trace(thmb.imgNum.text)
thmbHolder.x = i*(thmbHolder.width+5)+5;
thumbContainer.y = stage.stageHeight - thumbContainer.height;
function showImage(e:MouseEvent):void{
var imgIndx:Number = e.target.parent.parent.name;
prevThumb = currThumb;
currThumb = e.target.parent.parent;
currThumb.buttonMode = false;
if(activIndx != imgIndx){
prevThumb.buttonMode = true;
currentIndex = imgIndx-1;
shwNext(null);
activIndx = imgIndx;
} else {
stopScroll(null);
function preload():void{
var len:int = imageURLs.length;
for (var i:int = 0; i < len; i++) {
imageLoader = new Loader();
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onPreloadComplete);
loadedImages.push(imageLoader);
imageLoader.load(new URLRequest(imageURLs[i]));
function onPreloadComplete(e:Event):void {
e.target.removeEventListener(Event.COMPLETE, onPreloadComplete);
if (!showTimer && loadedImages[0].content && loadedImages[1].content ) startShow();
function startShow():void{
currentImage = loadedImages[0];
currentImage.alpha = 0;
slidesHolder = new Sprite();
var slideMask:Sprite = new Sprite();
var gr:Graphics = slideMask.graphics;
gr.beginFill(0xff0000);
gr.drawRect(0, 0, currentImage.width, currentImage.height);
gr.endFill();
addChild(slidesHolder);
addChild(slideMask);
slidesHolder.x = slideMask.x = 0;
slidesHolder.y = slideMask.y = 0;
slidesHolder.mask = slideMask;
slidesHolder.addChild(currentImage);
TweenLite.to(currentImage, 10, { alpha: 1 } );
showTimer = new Timer(timerDuration);
showTimer.addEventListener(TimerEvent.TIMER, slideTransition);
showTimer.start();
function slideTransition(e:TimerEvent):void{
var nextImage:int;
if(rt_lt_Flag == true){
if(nxtFlag == true){
showTimer.stop();
nxtFlag = false;
nextImage = currentIndex < loadedImages.length - 1 ? currentIndex + 1 : 0;
if (loadedImages[nextImage].content) {
currentIndex = nextImage;
loadedImages[currentIndex].x = slidesHolder.width;
slidesHolder.addChildAt(loadedImages[currentIndex], slidesHolder.getChildIndex(currentImage));
prevImage = currentImage;
currentImage = loadedImages[currentIndex];
showCurrent();
} else {
if(prvFlag == true){
showTimer.stop();
prvFlag = false;
nextImage = currentIndex > 0 ? currentIndex - 1 : loadedImages.length - 1;
if (loadedImages[nextImage].content) {
currentIndex = nextImage;
loadedImages[currentIndex].x = -(stage.stageWidth);
slidesHolder.addChildAt(loadedImages[currentIndex], slidesHolder.getChildIndex(currentImage));
prevImage = currentImage;
currentImage = loadedImages[currentIndex];
showCurrent();
activIndx = currentIndex;
//trace(currentIndex)
function showCurrent():void{
// make sure they have proper alphas
//prevImage.alpha = 1;
//currentImage.alpha = 0;
//TweenLite.to(prevImage, tweenDuration, { x: -slidesHolder.width } );
twnFlag = true;
if(rt_lt_Flag == true){
TweenLite.to(currentImage, tweenDuration, { x: 0, onUpdate:onTweenProgress, onComplete: removePrevious } );
} else {
TweenLite.to(currentImage, tweenDuration, { x: 0, onUpdate:onTweenProgress, onComplete: removePrevious } );
function onTweenProgress():void{
if(rt_lt_Flag == true){
prevImage.x = currentImage.x - prevImage.width;
} else {
prevImage.x = currentImage.x + prevImage.width;
function removePrevious():void {
if (slidesHolder.contains(prevImage)) slidesHolder.removeChild(prevImage);
twnFlag = false;
function stopScroll(e:MouseEvent):void{
ctrlBox.btnPlay.visible = true;
ctrlBox.btnPause.visible = false;
showTimer.stop();
function startScroll(e:MouseEvent):void{
rt_lt_Flag = true;
ctrlBox.btnPlay.visible = false;
ctrlBox.btnPause.visible = true;
resetListener(timerDuration=5000,tweenDuration=2)
function shwNext(e:MouseEvent):void{
if(twnFlag == false){
rt_lt_Flag = true;
stopScroll(null);
nxtFlag = true;
resetListener(timerDuration=0,tweenDuration=1)
function shwPrev(e:MouseEvent):void{
if(twnFlag == false){
rt_lt_Flag = false;
stopScroll(null);
prvFlag = true;
resetListener(timerDuration=0,tweenDuration=1)
function resetListener(timerDuration,tweenDuration){
showTimer.removeEventListener(TimerEvent.TIMER, slideTransition);
showTimer = new Timer(timerDuration);
showTimer.addEventListener(TimerEvent.TIMER, slideTransition);
showTimer.start();
Can you help me on how can i swap the depth of images and control buttons.
Thanks and regards,
Sreelash -
Compatibility Issues with AS3 & 2
This question has a few parts actually. Let me lay down the
groundwork - I'm starting a new project, but I have yet to decide
whether or not I will create it in AS 2 or 3. One thing the swf
will do is load other swfs into it - it also will need to somehow
connect with these loaded SWFs and transfer data back and forth. I
understand the compatability issues associated with loading AS 2
swfs into AS3 - see here -
http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=L iveDocs_Parts&file=00001801.html
At the bottom right of the chart, adobe suggests that AS 1.0
and 2.0 can "cross-script" with AS 3 using localconnection. There
are already SWFs developed that need to be loaded into my new
project, and I would like to create new SWFs as well, some of which
may benefit from being coded in AS 3 (as well as possibly being
created in Flex). I also think that overall my project will benefit
from using AS 3. However, there are a few issues that I can't
resolve - here are my problems -
If I create my project in AS 3, and then load SWFs that use
AS 2, the project can access the loaded SWF through a
localconnection - however, can they pass objects, like XMLNodes, to
each other, and each understand the other, even if one uses AS2 and
one uses AS3? Or can they only invoke functions on each other's
sides...
If they cannot pass objects to each other, what I may
consider doing it creating the project in AS3 and requiring all
SWFs that are to be loaded into the main project to be rewritten in
AS3 - that way the loaded swfs can pass data safely to the loader.
My other question - supposing this is the case, say I want people
to be able to develop SWFs for my project, but they are used to
using the flash IDE - flash 9 wont be out for a few months...they
can create an .fla in flash 8, write actionscript classes in AS3,
then load it all into the flash9 preview and compile...making their
swf compatible with my project...can they use components, which are
coded in AS2? I dont think AS3 differs so much from AS2 that they
couldnt just code normally and then compile in the flash9 preview,
but what problems may arise from developing in this fashion? Would
that mean that people coding in AS2 could simply make a few
adjustments for AS3, load the .fla into the flash9 preview and
compile and make an SWF that is compatible and accesible from my
project? Any help on these issues would be very much appreciated -
thanks!I was trying to test this for you in AppleWorks 6 Windows XP in Parallels on my MacBook Pro, but each time I tried to open a draw file I had originally create on my Mac, AppleWorks 6 for Windows crashed.
I tried another, smaller draw document & it opens without problems & I can move the objects around. I'd suggest deleting the AppleWorks preferences, but I don't know where they are in Windows XP. -
Hi to all!
I'm working on an as2 fla and I have to play a movie clip when a user click on a html link placed in the html outside the swf.
I did some trial and googled around but no way to get this to work. So i've tried to set up a simpler file to test the ExternalInterface.
The thing i'm trying to do is this (see also the attached files):
In flash, i placed on the stage a txt box on the first frame.
Always on the first frame i coded this:
flash.external.ExternalInterface.addCallback("funzia",ciccio)
function ciccio(){
txtProva.text='ciao'
In the html, accordin to the suggestion of Adobe i coded in js this:
function getFlashMovie(movieName) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
function apriDati() {
getFlashMovie("prova").funzia();
When I try to invoke apriDati() with Firebug it fails with the following error:
TypeError: getFlashMovie("prova").funzia is not a function source=with(_FirebugCommandLine){apriDati()\n};
It seems it doesn't recognize the object
If i Trace onlye the getFlashMovie("prova") i receive this output:
[object, embed]
and if i try getFlashMovie("prova")[0]
<object width="550" height="400" align="middle" name="prova" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">
and if i try getFlashMovie("prova")[0].funzia it fails with the same error listed above.
Any Ideas?
Thanks in advance.
Best regards and good weekend!!!!Hi kglad!
Thanks for your reply. I've tried to set the additional parameter you suggested, but it still doesn't work.
It's a very weird behaviour.
I also tried to get referenced to the flash movie with:
var flash=document.getElementById("FlashID")
instead of using the method suggested by Adobe
When I log the "flash" var in firebug, it returns:
<object id="FlashID" width="550" height="400" title="externalfile" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" style="visibility: visible;">
but when I try to perform:
flash.callMe()
it complains with:
"TypeError"
flash.callMe is not a function
What do you think?
This is only a flash issue, or there could be something also in the javascript side?
Thanks in advance!
Have a nice day!
Best Regards!
Luca -
JS Code:
function iclicked() {
var myFlashMovie = document.getElementById("flashID");
myFlashMovie.javaFn();
AS3 Code:
ExternalInterface.addCallback("javaFn", flashFn);
function flashFn() {
// Do this
The problem is that with this code, I receive an error that says javaFn is not a function.
I was researching and I read that the problem may be that there may not have been enough time for it to completely load but I doubt that is the problem.
I am willing to try this solution but how would I go about not going any farther, until five seconds have passed by?
Are there any solutions out there?I changed the JS to:
function iclicked() {
var myFlashMovie = window.document.flashID;
myFlashMovie.javaFn();
I am still getting the same error.
I can't even do, "myFlashMovie.play()". -
NPAPI ExternalInterface "issues"
So I'm writing an app which hosts the flash plugin using
NPAPI. Now, I've not got a javascript engine so I need to use
NPN_Invoke and its kins.
Unfortunately when I call out to from flash to the host e.g.
ExternalInterface.call( 'testfunc', 'arg1', 56, { 'some':
66, 'inter':'est' } );
I DON'T get NPN_Invoke called, instead it calls NPN_Evaluate
wrapping the call I'm trying to make in another javascript function
(__flash__toXML) which converts the return return value to XML,
which is frustrating as I don't have a javascript engine.
Now I've noticed that by changing the user agent I return,
flash changes how it queries values e.g. sometimes it invokes
top.location, sometimes it evaluates a javascript function (using
NPN_Evaluate) to retrieve it.
What I want to know is "Can I make Flash call Invoke rather
than Evaluate", Its soooo frustrating as I don't want or need a
javascript engine and there's no reason it shouldn't be able to.
I've found I can avoid the need to handle NPN_Evaluate when calling
into flash by invoking "CallFunction" and serializing the
parameters into xml, so I'll be amazed if I can't get calling out
to work without NPN_Evaluate.
Please help
Richbump!
Anyone? is there anyway to get flash to call invoke instead
of evaluate with a javascript string?
Help!
Rich -
External variable issue using AS3 in FlashCS3
I am trying to pass database values into Flash (using AS3)
through a simple PHP script output! The trouble is ... I have not
been able to get Flash/AS3 to acknowledge that it has received the
supposedly externally loaded data, let alone prove that it is ready
to work with the values passed into it in some way. So, OK...
...here is my PHP code (phpCode.php):I tested your code and it works just fine on my local WAMP
installation?
My output panel traces:
lname is theLastName
fname is theFirstName
Have you stepped through your code line by line with the
debugger to see where flash is messing up?
Cheers,
Flashtastic -
Embed font issue (cs5 as3)
After reading several pages and trying many examples I am stuck.
I can't get the Japanese text i have in an external file in a generated textfield.
I have a 'stripped' example here http://www.credendo-vides.com/embedFontIssue.fla
about the example
- textstring with example text put inside example document
- no generated textfields
- two textfields on stage
1e: texfield has text in it that is replaced with 'dynamic' content
2e: textield is not filled with 'dynamic' content
any help is welcome
Regards,
PeterThanks guys,
Changing to another font worked.
Regards,
Peter -
Not sure if anyone can help however I came across a tutorial
by Lee Brenmlow titled 'Advanced After Effects and Flash' at
www.gotoandlearn. The tutorial is great however I get an error when
I test my movie and I think it is something to do with the tweener
class Lee touches on breifly. I have looked at some other tutorials
where tweener is used but I am still not any wiser if I have
installed it correctly, placed in the right directory etc. The
error I get when testing the movie is
'## [Tweener] Error: The property '_frame' doesn't seem to be
a normal object property of [object movie_1] or a registered
special property.'
Hope someone can show me the error of my ways and provide the
solution to get this working
Kind regards
DavidAh, _frame is a special property, added by Tweener. But that
probably changed in an upgrade of the package, so add the following
lines and you're ok.
import caurina.transitions.properties.DisplayShortcuts;
DisplayShortcuts.init(); -
Can C++ Container Determine AS2 vs AS3
I have a C++ container of Flash Player 11 (I have also tried
Player 9 and Player 10). How can the container ask the player what
type of content it is playing (AS2 or AS3)?
If I create an event handler (ExternalInterface.addCallback)
in AS3 which returns true (depicting AS3), and call
m_FlashPlayer.CallFunction in my container, I am able to
receive/parse the ActionScript response ("<true/>").
However, if the content is "old" (i.e. AS2 which does not
have the necessary event handler) ... or if the content is AS3 and
I deliberately throw an exception (throw new Error("AS3 Error") in
my event handler) ... the C++ container has no way of
differentiating between AS2 or AS3. My container catches the
COleDispatchException, but there is no information within the
exception. Both scenarios result with an m_scError = 0x80004005
(E_FAIL).
Is there a prescribed way for a container to ask the
Shockwave player if it is playing AS2 or AS3 content?You are confusing the Shockwave Player (which runs
Director-created
content) with the Flash Player -
Captivate AS3 errors in firefox?
Hello,
I'm having an issue with AS3 errors coming up on the first slide of my training/quiz in firefox. I am using captivate 4. This is what is showing up:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at captivate.Veela_AS3::rdQuizPlaybackController/get currentSlideContainer()
at MMQuizzingV4_AS3.MMQuizClasses::PlaybackController/allowedToGoToSlide()
at captivate.Veela_AS3::rdMovie/gotoSlide()
at captivate.Veela_AS3::rdMovie/JumpToSlide()
at captivate.Veela_AS3::cpTOCManager/delayedGoToSlide()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at SetIntervalTimer/onTimer()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
The error will not show up in IE.
I have doublechecked my project preferences and it is indeed set to AS3. I have imported a small .swf to each slide with VERY basic animation just simple tweens. There is some actionscript on the imported .swfs such as stop or switch statements. Nothing that is rocket science and it validated in flash. These errors seem to be coming from the captivate program itself. I have to integrate this training into an LMS will these errors mess that up?If anyone had some time or insight I would be very appreciative!
Cheers!
-MattPossibly the problem discussed in these threads:
strange tags
HTML tags showing up in the pages also in 2.0? -
Hey one and all. Looking for a little insight on AS3 and its
masks. I have a clip that I have applied a mask to. This mask is a
gradient mask (linear - white 0%, black 100%, white 0%). I've set
cacheAsBitmap to true for both the clip and the mask and applied
the mask in AS3. However, the transparency in the mask isn't there.
Has anyone had similar issues with AS3 applied masks and how do I
go about getting this resolved?I see what you're saying chadder but I have another issue in
my case. Let me explain.
I'm masking an image reel here. The reel contains two things
the moving reel and the mask. so..
imgreel
*imagereel
*imagemask
The imagereel is dropping in x number of loader instances
(per image loaded). When I applied your technique, nothing
occurred. I'd imagine because imagereel is updating the display
after each load but I'm not 100% sure of that. Any idea what might
be occuring here? -
Problem with Checkbox and Button components....(Simple one)
Hi all,
As I am new to flash and ActionScript 3.0,I have the following issue regarding Flash.
I have 2 swf files whose contents are as follows: First.swf file contains a check-box (instance name:my_checkbox). Second.swf file contains a button component(say,label name of Submit and with instance name: submit_btn).
Now, my requirement is: Whenever I click the submit_btn button, then the check_box must be get selected/visible. If I click it once again, then it must get deselected/invisible. The process must be continued till I stop the click-event on button component.
Reply me as soon as possible.. Thanks in advance...
Srihari.ChHi Ross Ritchey,
I am attaching the two .fla files(with ActionScript 3.0 code in respective layers) that are resultant to your reply. (viz., CheckDemo.fla &&ButonDemo.fla respectively). Please check them once..
The functionality (i.e., When ButtonDemo.swf file is executed and the Submit button("myBtn") is clicked, the Checkbox component(s) present in "CheckDemo.swf" file is getting appeared in "ButtonDemo.swf" and is ready to access. Also, the selection/enability/visibility also works properly).
Also, check the added code.I had added all the required code to fulfil the requirement.
When I click the "Submit_btn", the checkbox components placed in "CheckboxDemo.swf" file are appearing in "ButtonDemo.swf". Instead, I don't need to get them.
So, here my requirement is: " When i click "submitButton" in ButtonDemo.swf file, then the action must be performed to the checkbox component(s) present in CheckDemo.swf file.
Thanks a lot for your help. I am so happy with your reply, because(As you know, I am new to Flash/AS3), after a long time my is getting forward. And I hope the same form of reply to this mail or issue.
AS3 code in ButtonDemo.fla:
var url:String="CheckDemo.swf";
var urlRequest:URLRequest=new URLRequest(url);
var myLoader:Loader = new Loader();
myLoader.load(urlRequest);
addChild(myLoader);
myBtn.addEventListener(MouseEvent.CLICK,doChangeCheckbox);
function doChangeCheckbox(e:MouseEvent):void {
(myLoader.content as MovieClip).myCheckbox.selected = !(myLoader.content as MovieClip).myCheckbox.selected;
(myLoader.content as MovieClip).myCheckbox2.enabled = !(myLoader.content as MovieClip).myCheckbox2.enabled;
(myLoader.content as MovieClip).myCheckbox3.visible = !(myLoader.content as MovieClip).myCheckbox3.visible;
Srihari.Ch -
WARNING: Actions on button and MovieClip
I have the following code that I am trying to get to work
with ActionScript 3.0:
on (rollOver) {
gotoAndPlay("s1");
on (releaseOutside, rollOut) {
this.gotoAndPlay("s2");
on (release) {
this.gotoAndPlay("s2");
The problem is that ActionScript 3.0 will not allow the
script on a MovieClip instance. I am at a loss with what to do, I
work well with examples, so I have posted 2 source FLA that are
identical, the only difference is that one targets ActionScript 2.0
(and works), the other targets ActionScript 3.0 (and does not
work).
Please
take
a lookThere is no need to grasp the changes that fast. You can
still publish files for AS2.
Personally though I am always amazed that folks are still
using the on(clipEvent) style of coding. Generally that style of
coding should have gone away with the introduction of the
MovieClip.onClipEvent syntax with Flash 6 – introduced in
Spring of 2002. If you have been programming AS since 2002 and are
still relying solely on on(clipEvent) then you have bigger issues
than AS3. If you have come to AS more recently I just wonder why
this style was the one you adopted. (By "you" I don't mean you
– tmcquage – specifically. I mean you in the general
sense, and I include all of the Flash community in why did we allow
this to happen.)
You could probably answer that question yourself quick than
posting here! But I just tested it and the stop(); works fine.
I would recommend sticking with AS2 for the time being. Learn
how to use all the movieclip methods from the main timeline, not
from on an instance. Then the change over to AS3 won't be such a
shock. Even if you never go to AS3, you will be so happy you
stopped using instance code. Really. -
I have racked my brain over a seemingly simple question that turned out to be far more difficult for me than expected.
I want to pass three variables from a Flash CS4 movie to Director 11.5 lingo. Not being a Flash expert, I got stuck with an incompatibility issue between AS3 and D11.5. The GetURL method mentioned in the D11.5 manual refers to the (outdated) AS2, and I couldn't get the function *getValue()* to work either.
The Flash .swf movie that I imported into Director as a Flash spriteworks well. It passes the three variables to the Director message window via the trace command, but there is no way to extract them from there in Lingo.
And I cannot revert to AS2, because I'm using AS3 with an OpenCV face tracking routine.
So could anybody please help me showing me how to pass the variables from AS3 to D11.5 (similar to the AS2-based example shown here: <http://kb2.adobe.com/cps/147/tn_14798.html>)? I need a simple code sample that I could then integrate into my existing face tracking AS3 script.Just in case anybody is interested – I found a solution that works with AS3 and D11.5 Lingo.
In AS2 I could pass a string variable to Director Lingo with a "getURL(StringVal))" command. In Lingo I would read it with these lines of code:
on getURL me, stringFromFlash
x = stringFromFlash
put x (or whatever...)
end
When I replaced the getURL method with the following code in my AS3 script
"navigateToURL(new URLRequest(StringVal));"
For good measure I added a few tablespoons of imports at the top of the recipe:
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;
import flash.net.navigateToURL;
A Flash expert could probably tell us which ones aren't essential.
it worked! Please don't ask me why :-)
Of course, any numerical data can be converted to a string in Actionscript and converted back to numerical data in Lingo.
Maybe you are looking for
-
To capture the Mini-DV file through the 1394 firewire card from t
hii there! first let mi make you understand what we people are doing .... We people want to capture the Mini-DV file directly through the 1394 firewire card from the sony camcorder in to the MPEG2 format. Thent on the fly(i.e.during capturing into MP
-
External screen in vertical mode - how to do it ?
I have a 20" Dell external screen which can rotate 90 degrees, I need to use it in vertical mode but I don't know how, neither if it's possible with the ATI Mobility Radeon 9000 card which is in my Powerbook. Is it possible with Tiger ? Thanks if any
-
How to add two duration in a date rule
Hello Experts I need to add two duration's in a date rule . previously i have only added a single duration to a date type.The code i am using is <?xml version="1.0"?> <TimeRule> <TimeRuleSource> <ruleline> <AssignTimeExp>
-
Replacement ipod touch not recognised by computer/itunes - help?
Apple store replace ipod touch 4thgen. New ipod not recognised by computer/itunes. Can't figure out the problem - help please.
-
Organizing and deleting Duplicate Photos in iPhoto library?
Can I easily organize and delete duplicate photos in my iPhoto library?