As2 linked to as3 ?

I am working on an inherited project with a tight deadline, and  I have a large as2 file with xml that appears to calling up an as3 flash file that also has xml, but its not working so I cant tell for sure.  Is this possible to do?
Barbara

This is the beginning of the productDetails.fla  it cant find the xml cuz I am getting this error
TypeError: Error #2007: Parameter url must be non-null.
at flash.net::URLStream/load()
at flash.net::URLLoader/load()
at ProductDetails_fla::MainTimeline/frame1()
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.display.StageDisplayState;
import flash.text.Font
import classes.ProductDetails;
import classes.ClickableMovieClip;
ProductDetails.FileName = this.loaderInfo.parameters.XMLFile
ProductDetails.Product = this.loaderInfo.parameters.LoadProduct
ProductDetails.SelectedTab = this.loaderInfo.parameters.LoadSelectedTab
ProductDetails.IsIE6 = this.loaderInfo.parameters.IsIE6
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest(ProductDetails.FileName));
function LoadXML(e:Event):void {
ProductDetails.xmlData = new XML(e.target.data);
switch(ProductDetails.Product.toLowerCase()) {
case "classics":
ProductDetails.xmlProduct = new XML(ProductDetails.xmlData.products.classics);
ProductDetails.xmlProducts = new XMLList(ProductDetails.xmlData.products.classics.product);
break;
case "fresheffects":
ProductDetails.xmlProduct = new XML(ProductDetails.xmlData.products.fresheffects);
ProductDetails.xmlProducts = new XMLList(ProductDetails.xmlData.products.fresheffects.product);
break;

Similar Messages

  • Dummy Guide needed for converting AS2 code into AS3

    I have to convert my existing AS2 code into AS3, but I might as well be reading chinese. I never even began to learn AS3, it was still fairly new at the time and the class ended before we had an opportunity to even touch on it. My major was not web design, it was the print side of design. I took an additional class, after I graduated, to learn web design and our teacher told us, basically, that we were designers, not coders so we won't be getting much into actionscripting, beyond the basics. At the time I was relieved, but looking back, I really wish we would have gotten more into it. Bottom line, I need to learn now.
    Is there ANYONE that can help me out? I will list my code below, buy I am way beyond lost any help that can be provided, I would be so grateful!!!!
    On the main timeline I have the basic..
    stop(); -- I found the AS3 version, but I don't know what I'm looking at. I get "not_yet_set.stop()" and there are are 8 options I can choose from. I just want the timeline to stop until I tell it where to go next. And what is "not_yet_set"
    Then I have my buttons, which are, basically...
    on (release) {
    gotoAndStop("Home");
    Or "gotoAndPlay("Whatever");"
    I also have buttons for scrolling...
    on (press) {
    play();
    on (release) {
    stop();
    AND
    on (press) {
    _root.AboutMe_Controller.gotoAndPlay(…
    on (release) {
    _root.AboutMe_Controller.gotoAndStop(…
    For the on(release) command, this is what I found as the AS3 version: not_set_yet.dispatchEvent()

    because that's really as1 code, you have steeper learning curve than going from as2 to as3.
    first, remove all code from objects, assign instance names to your buttons and you can then start on as3:
    // so, if you name your home button, home_btn:
    home_btn.addEventListener(MouseEvent.CLICK,homeF);
    function homeF(e:MouseEvent):void{
    gotoAndStop("Home");
    p.s.  the not_yet_set stuff is there because you tried to use script assist or some other actionscript shortcut.

  • Help! Convert simple Flash AS2 code to AS3

    Hi everyone,
    I'm a Flash beginner and followed a tutorial: http://www.webwasp.co.uk/tutorials/018/tutorial.php ... to learn how to make a "live paint/draw" effect. I didn't realize  that if I made something in AS2, I wouldn't be able to embed it (and  have it work) into my root AS3 file, where I've got a bunch of other  stuff going on. I've tried following tips on how to change AS2 code to  AS3, but it just doesn't work. I know it's simple code, and that some  genius out there can figure it out, but I'm at a loss. Please help!
    Here's the AS2 code:
    _root.createEmptyMovieClip("myLine", 0);
    _root.onMouseDown = function() {
       myLine.moveTo(_xmouse, _ymouse);
       ranWidth = Math.round((Math.random() * 10)+2);
       myLine.lineStyle(ranWidth, 0xff0000, 100);
       _root.onMouseMove = function() {
          myLine.lineTo(_xmouse, _ymouse);
    _root.onMouseUp = function() {
       _root.onMouseMove = noLine;
    Thanks in advance!
    Signed,
    Nicolle
    Flash Desperado

    Considering the code is on timeline:
    var myLine:Sprite = new Sprite();
    addChild(myLine);
    var g:Graphics = myLine.graphics;
    addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
    function onMouseDown(e:MouseEvent):void {
         var ranWidth:Number = Math.round((Math.random() * 10) + 2);
         g.clear();
         g.lineStyle(ranWidth, 0xFF0000, 1);
         addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
         addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
    function onMouseMove(e:MouseEvent):void {
         g.lineTo(mouseX, mouseY);
    function onMouseUp(e:MouseEvent):void {
         removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
         removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);

  • Change as2 code to as3

    I used a tutorial http://www.flash-game-design.com/flash-tutorials/funky-flash-website-tutorial-5.html to make a menu for my application, I've tried following tips on how to change AS2 code to AS3, but it just doesn't work.
    menu = ["bulls", "about", "roster", "schedule"];
    var current = menu[0];
    for (var i = 0; i<menu.length; i++) {
    var b = menu[i];
    this[b+"_btn"].stars._visible = false;
    this[b+"_btn"].txt = b;
    this[b+"_btn"].onPress = function() {
    _root.site[current+"_btn"].stars._visible = false;
    _root.site[this.txt+"_btn"].stars._visible = true;
    current = this.txt;
    _root.site.content.gotoAndStop(this.txt)
    this[current+"btn"].stars._visible = true;
    this.onEnterFrame = function() {
    this[current+"_btn"].stars.s1._rotation += 1;
    this[current+"_btn"].stars.s2._rotation += 0.5;
    Thank you,
    Glenn

    Just a note. Function declarations in a loop is an EXTREMELY bad practice that will lead to many problems if it doesn't have some already. So, the following lines:
    for (var i:int = 0; i<menu.length; i++) {
        var b:String = menu[i];
        this[b+"_btn"].stars.visible = false;
        this[b+"_btn"].addEventListener(MouseEvent.CLICK,fn);
        this[b+"_btn"].txt=b;
        function fn(e:MouseEvent):void{
            this[current].stars.visible = false;
            var nam:String=e.target.parent.name;
            this[nam].stars.visible = true;
            current = nam;
            //MovieClip(root).site.content.gotoAndStop(this.txt)
    should be:
    for (var i:int = 0; i < menu.length; i++) {
         var b:String = menu[i];
         this[b+"_btn"].stars.visible = false;
         this[b+"_btn"].addEventListener(MouseEvent.CLICK,fn);
         this[b+"_btn"].txt=b;
    function fn(e:MouseEvent):void {
         this[current].stars.visible = false;
         var nam:String=e.target.parent.name;
         this[nam].stars.visible = true;
         current = nam;
         //MovieClip(root).site.content.gotoAndStop(this.txt)

  • Load as2 swf in as3 swf

    Hi All,
    I am new to this forum.
    Can anyone tell me how to load as2 swf in as3?
    If this is possible,can anyone give me some sample example?
    Thanks
    Harshal

    You can talk to loaded AVM1 (AS1/2) SWF using LocalConnection. I used Grant Skinner's SWFBridge class in the past and worked very well:
    http://gskinner.com/blog/archives/2007/07/swfbridge_easie.html
    Kenneth Kawamoto
    http://www.materiaprima.co.uk/

  • Load AS2 swf into AS3 swf problem

    I have a flash with AS3 and inside this swf i load in a AS2 swf.
    to load swf works just fine, but the problem is when i load this i want to go to
    a specific part of it, for example i want to go to frame 3 in the loaded swf.
    i must control this from the AS3 swf, does someone know if this is possible?
    thanks in advance

    so can i do like this then to go to frame 3 in my loaded swf?
    MovieClip(ldr.content).gotoAndStop(3); ?
    sorry for being such an airhead
    thanks for helping me out =)
    Date: Sun, 7 Jun 2009 10:25:09 -0600
    From: [email protected]
    To: [email protected]
    Subject: load AS2 swf into AS3 swf problem
    no.
    if, in your loaded swf, you have a function f1() on the loaded swf's main timeline and you load that swf using a loader (say ldr), use:
    MovieClip(ldr.content).f1();   // to call f1() in the loaded swf
    >

  • Load AS2 SWF in AS3 SWF with FlashVars

    I am able to load SWF which is created using AS2 in to AS3
    SWF but I am not able to pass Flashvars to it..
    Does any one has any idea, how can I do that??
    Thanks

    You can talk to loaded AVM1 (AS1/2) SWF using LocalConnection. I used Grant Skinner's SWFBridge class in the past and worked very well:
    http://gskinner.com/blog/archives/2007/07/swfbridge_easie.html
    Kenneth Kawamoto
    http://www.materiaprima.co.uk/

  • Main movie in AS2 and MC AS3

    Dear all,
    I have a main movie is coding AS2 which contains a movieClip called MC_header.
    And I have an external movie is coding with AS3.
    My question is :
    Can i loadmovie the external movieclip in the main movie????
    if yes, how?
    thanks
    MELAS

    Nope. If the original movie is AS3 you can load in an AS2 clip and it will run as an AVM1 (ActionScript Virtual Machine 1, which understands AS1 and 2) Movie. But the AVM1 has no idea about AVM2 (which understands AS3) so you can't go the other way.
    Even when you do load an AS2 into and AS3 file the communication between the main file and the loaded AVM1 movie is quite limited and you won't be able to control it the way you would if they were both of the same flavor -- if that is important to your project.

  • Converting external link as2 script to as3

    Hello.
    I used this script I found online to make a Flash file that accessed an external text file full of hyperlinks through buttons in the Flash movie. The code is as2. I had to update the Flash file to AS3 and now the script doesn't work. I can't figure out how to do the same thing that this script does in AS3. Can anyone help me?
    Here is the AS2 script:
    textFile = new LoadVars()
    textFile.onLoad = function(){
    buttonlink1 = this.BlackBooklink;
    buttonlink2 = this.Ashtraylink;
    buttonlink3 = this.bedroomlink;
    buttonlink4 = this.tvlink;
    buttonlink5 = this.spiderlink;
    buttonlink6 = this.Mirrorlink;
    buttonlink7 = this.Boomboxlink;
    buttonlink8 = this.Suitlink;
    buttonlink9 = this.cashlink;
    buttonlink10 = this.fastfoodlink;
    buttonlink11 = this.Idolatrylink;
    buttonlink12 = this.Trashlink;
    textFile.load("LeftHouseLinks.txt");
    //---buttons
    BlackBook.onRelease = function(){
    getURL(buttonlink1, "_self");
    Ashtray.onRelease = function(){
    getURL(buttonlink2, "_self");
    bedroom.onRelease = function(){
    getURL(buttonlink3, "_self");
    tv.onRelease = function(){
    getURL(buttonlink4, "_self");
    spider.onRelease = function(){
    getURL(buttonlink5, "_self");
    Mirror.onRelease = function(){
    getURL(buttonlink6, "_self");
    Boombox.onRelease = function(){
    getURL(buttonlink7, "_self");
    Suit.onRelease = function(){
    getURL(buttonlink8, "_self");
    cash.onRelease = function(){
    getURL(buttonlink9, "_self");
    fastfood.onRelease = function(){
    getURL(buttonlink10, "_self");
    idolatry.onRelease = function(){
    getURL(buttonlink11, "_self");
    trashtalk.onRelease = function(){
    getURL(buttonlink11, "_s
    This is the external .txt file content
    &BlackBooklink=http://www.yahoo.com
    &Ashtraylink=http://www.google.com
    &bedroomlink=http://www.yahoo.com
    &tvlink=http://www.google.com
    &spiderlink=http://www.yahoo.com
    &Mirrorlink=http://www.google.com
    &Boomboxlink=http://www.yahoo.com
    &Suitlink=http://www.google.com
    &cashlink=http://www.yahoo.com
    &fastfoodlink=http://www.google.com
    &Idolatrylink=http://www.yahoo.com
    I know how to make AS3 button work, I just don't know the code so that when I click the button, it accesses the external file and goes to the hyperlink specified by the button.
    Any help would be much appreciated.
    -Shawn

    Hi Ned.
    I have officially lost the rest of what's left of my hair over this.
    Here is the code I am using now. For whatever reason the variable
    buttonlink1 I have set up is not being recognized:
    var myTextLoader:URLLoader = new URLLoader();
    myTextLoader.addEventListener(Event.COMPLETE, onLoaded);
    function onLoaded(e:Event):void {
                trace(e.target.data);
    var buttonlink1;
    buttonlink1 = this.BlackBooklink;
    myTextLoader.load(new URLRequest("LeftHouseLinks.txt"));
    BlackBook.addEventListener ( MouseEvent.CLICK, myBlackBookHandler )
    function myBlackBookHandler( evt ){
                navigateToURL(new URLRequest(buttonlink1), "_self");
    This is the resulting error message and below that is the text of the
    external text file which is loading into Flash:
    Any ideas? Thanks.
    -Shawn
    TypeError: Error #2007: Parameter url must be non-null.
                at global/flash.net::navigateToURL()
                at SoulDecisions07_fla::MainTimeline/myBlackBookHandler()
    &BlackBooklink=http://www.yahoo.com
    &Ashtraylink=http://www.google.com
    &bedroomlink=http://www.yahoo.com
    &tvlink=http://www.google.com
    &spiderlink=http://www.yahoo.com
    &Mirrorlink=http://www.google.com
    &Boomboxlink=http://www.yahoo.com
    &Suitlink=http://www.google.com
    &cashlink=http://www.yahoo.com
    &fastfoodlink=http://www.google.com
    &Idolatrylink=http://www.yahoo.com
    &BlackBooklink=http://www.yahoo.com
    &Ashtraylink=http://www.google.com
    &bedroomlink=http://www.yahoo.com
    &tvlink=http://www.google.com
    &spiderlink=http://www.yahoo.com
    &Mirrorlink=http://www.google.com
    &Boomboxlink=http://www.yahoo.com
    &Suitlink=http://www.google.com
    &cashlink=http://www.yahoo.com
    &fastfoodlink=http://www.google.com
    &Idolatrylink=http://www.yahoo.com
    &BlackBooklink=http://www.yahoo.com
    &Ashtraylink=http://www.google.com
    &bedroomlink=http://www.yahoo.com
    &tvlink=http://www.google.com
    &spiderlink=http://www.yahoo.com
    &Mirrorlink=http://www.google.com
    &Boomboxlink=http://www.yahoo.com
    &Suitlink=http://www.google.com

  • FlashVar to as2 loaded into as3

    I am afraid I already know the answer to my question but I am
    hoping otherwise. Previously an AS2 movie loaded into an AS2 movie
    could get flashvar values through _level0 or _root. My problem is
    having an AS2 movie loaded into an AS3 movie and still letting the
    loaded AS2 have access to the flashvars. I can successfully get the
    flashvars into the AS3 movie so that isn't an issue. I searched
    around and couldn't find any posts that helped and if this has
    already been covered I would appreciate a point in the right
    direction.

    First off thank you for your replies, links and help.
    So my fears were correct, there is no easy solution. I was
    hoping that I could use loader variables to load flashvars to the
    loaded clip or something where I could still have the as2 continue
    to use _level0. The reason for keeping _level0 is the classic "I
    don't want to rewrite everything."
    Thanks again.

  • Combining AS2 animation in AS3 CP4 project

    I realize this is a no-no, and the message told me so in CP4, but I was able to get an AS2 built flash animation to work and publish in an AS3 CP project. The message, if I remember right, was 'you may experience unexpected results' or something to that effect. My question is: if I can get them to work as animated intros to the modules running as standalones, why can't  I get them to work in an Aggreagtor file? What happens when aggreagted is that the flash intros simple bog down. They start out playing correctly the first time, but as you navigate the TOC the animated intro starts playing slower and slower. It's as if the previous version are still playing the in the background and just run out of memory/cache or something.
    What I'm wondering is, could the problem be that the animations just simply aren't stopping? If so, is it possible to insert a command to stop?
    Anyone have any ideas?
    JT

    I was able to get them to play 'satisfactorily' in CP 4 in single .swf- Not aggreagated. The larger problem was in Aggreagator. I had huge issues with aggregator, and adobe told me to upgrade to CP5 to solve that problem. Not sure that probelm is solved because now I have even more problems with the existing files-captions, graphics not displaying correctly. So for the time being, this AS2 AS3 issue is on the sidelines.
    If I ever get to that oint again, I'll see If I can send a link.
    Thanks!
    JT

  • MP3 plays fine in AS2, but not AS3

    I have this code written in AS2 to play an MP3:
    var my_sound:Sound = new Sound();
    my_sound.loadSound("
    http://download.podango.com/mediatracker/1/67943/ApplePhoneShow_46.mp3",
    true);
    Here is the code written in AS3:
    var snd:Sound = new Sound(new URLRequest("
    http://download.podango.com/mediatracker/1/67943/ApplePhoneShow_46.mp3"));
    snd.play();
    They both play the file, but the AS3 version is choppy.
    Why would this be?
    -bmorrise

    DVX100Shooter,
    I am having a very similar problem, except it is happening to ALL of my music. For your case, perhaps you could try exporting to WAV from Soundtrack Pro (not sure if that is an option), and then let iTunes encode the audio in whichever format you choose. There shouldn't be any loss in quality in doing that.
    As far as my situation, I have updated my iPod (5th Gen 80GB Video) to the latest firmware (v1.3), iTunes is completely updated, OS X v10.5 is completely updated. I have restored my iPod on both PC and Mac, but no luck. Basically, no matter what songs I put on my iPod (MP3s or Apple Lossless), nothing will play on the iPod. I can fully browse the library on the iPod, but when I select a song to play, it just sits at 0:00 forever. If I hook the iPod up to a computer, I can play the music off of it just fine, which indicates that the hard drive is working just fine. Adding however much music I want to works just fine. I even stumbled across the Diagnostics tests, all of which passed with no errors. To me, it just seems that the iPod wants to play the song, but for some reason the compressed data isn't getting through the decoder....or....the music is decompressed OK but won't go through the digital-to-analog converter. Anyone have any suggestions for either my or DVX100Shooter's case?

  • Noob question: How to update very basic as2 code to as3.

    I've been asked to update a web banner with old as2 code, and not being a coder or a regular Flash user, I'm stuck with what I'm sure is a simple problem. The code in the opening frame is;
    function timeOut(pauseTime) {
      stop();
      pauseTimer = setInterval(this, "goPlay", pauseTime);
    function goPlay() {
      play();
      clearInterval(pauseTimer);
    After that there are a few frames that include timeOut(500); code, which seems basic enough, so I imagine my problems are all in the opening code.
    I get 4 errors that all refer to Frame 1;
    1120: Access of undefined property pauseTimer.
    1067: Implicit coercion of a value of type CapOne_MM_648x480b_fla:MainTimeline to an unrelated type Function.
    1067: Implicit coercion of a value of type String to an unrelated type Number.
    1120: Access of undefined property pauseTimer.
    Can anyone help or point me in the right direction? Thanks.

    For the code you show there would be no need to convert to AS3 since between AS2 and AS3 it hasn't changed.  One thing you do need to do is declare variables and since pauseTimer is used in mutliple functions it needs to be declared outside any functions.  Another thing you need to do is specify the variable types, including the arguments passed into function.  As for the setInterval call itself it appears to be written incorrectly....
    var   pauseTimer:Number;
    function timeOut(pauseTime:Number) {
          stop();
         pauseTimer = setInterval(goPlay, pauseTime);

  • Help plsss converting this AS2 code to AS3!!

    here is a little AS2 code that is in fact a photo gallery
    that i use in my site and i want to convert it to AS3 but i just
    cant seem to get it right... could someone plssss help me?!?!

    with what part are you having trouble?

  • Need assistance converting some AS2 code to AS3

    Hi,
    I have some simple AS2 code that brings in a MovieClip when
    you click a button. This is currently AS2, and I would rather
    convert it to AS3. I also have some code which closes the MovieClip
    upon button Click.
    The code I am currently using is below:

    addMC is the name of one of the event handler functions, not
    the button(s). the button instance names are: addButton and
    removeButton.
    To have three of them, duplicate what you see and have new
    variables, functions, and button names for all three sets, adjusted
    appropriately.
    I'm pretty sure this isn't over yet, I'm just giving you code
    per your defined scenario, which may have a hole or two in it. Try
    it out and see what you really want to do, then come back when you
    find out things need to be tamed in some way or aren't working as
    you want. There are more complicated ways to deal with a situation
    depending on what you really want, and I'm one who prefers to see
    some work done at your end that shows you've tried something (I'm
    not mean, much, I just have this thing about learning by doing).

Maybe you are looking for

  • Can I use the same sync cord for my 1st Gen and 2nd Gen iPod?

    I have to replace my sync cord (house fire) and I wondered if I could buy just one cord to sync both my iPods? I have a 1st Gen and a 2nd Gen.

  • Help with LabView and Java

    Hi any help would be greatly appreciated: I have the following JAVA code: //File: Hello.java class Hello {  public native void Steve();  static {   System.loadLibrary("steve");  public static void main(String[] args) {   Hello h = new Hello();   h.St

  • Opening fdf files.

    How do I get the Adobe Reader to open an fdf file that was created by the Submit button in an Adobe fillable file?

  • What Book is the Best?

    What book would you recommend out of this lot: http://www.amazon.co.uk/s/ref=nb_ss_w_h_?url=search-alias%3Daps&field-keywords=flex&am p;Go.x=0&Go.y=0&Go=Go Im a beginner and want to know more about flex, as 3 and php integration with flex... Thanks!

  • Photostream enabled but not synching on Mac

    I have photostream enabled on iPhoto 9.6, but it stopped synching all of my photos.  I have installed all updated and restarted, but it won't pull in the rest of my pictures.  Any ideas on how to fix it?