Extract graphics from loaded swf / Big problem

Hello,
my English isn't very good, so sorry for mistakes I have swf which consist of many vector graphics.
You can show it right here: http://www.watchtime24.sisco.pl/moje...orowanka_1.swf
If I import the swf to the stage, than I can manipulate this graphics. But this is not enough for me. I need to manipulate from Action Script.
I need to change the colors of this piceses from AS. I tried to use function
getObjectsUnderPoint(new Point(mouseX, mouseY))
but it doesn't work. This function doesn't see shapes, graphics or something else.
Is any solution which can fix my problem ? Has anyone any idea ?

Hey Mich,
What you can do is turn eachof the items in your shapes, into a movieClip or sprite or even a bitmap.
like the boy in the drawing.. take all of thsoe and then convert them into a movieClip.  Then when you do this give them a name and export them for actionscript.  Give this a class Name.
then when you load the swf, you can actually target those files with this line.
Say i converted the BOY into a movieClip.
import flash.system.ApplicationDomain
import flash.utils.geClasstDefinition
var myswfHoldingBoy
var myLoader:URLLoader = new URLLoader()
      myLoader.addEventListener(Event.INIT,onInit)
     var myURLRequest('path to myswfHoldingBoy')
myLoader.load(myURLRequest)
privaate function onInit(e:Event){
//here is where we will extract the boy for the library of the other swf
var ldrAppdomain= e.target.loaderInfo.applicationDomain
var boyObject:Class= ldrAppdomain.getByDefinition('class name you gave the boy as i said eralier') as Class
// now we have boyObject that will be able to be used as a class
addChild(new boyObject())  // this will addYourBoy movieClip to the stage.  but keep a reference to him so that you can then manipulate him.

Similar Messages

  • Extract graphics from fla

    Hi,
    I have a load of FLA files with large libraries of vector graphics.
    Is there a way of forcing Flash to create an export(jpg or swf)of all the graphics in a library without having to manually drag them onto the stage or into a scene before publishing or exporting them?
    I'm thinking there might be an SDK or utility or something that can read fla files and export everything programmatically.
    Any ideas?
    TIA,
    Paul.

    Great thanks. Here's link to a decent example showing how to export images from an FLA library:
    http://flexcomps.wordpress.com/2008/08/20/jsfl-export-batch-images-to-flaswf/
    Extract graphics from fla

  • Invoking class from loaded swf

    I'm working on a project where I'm loading in a video player
    as an external swf to my main movie. I'm not able to get my video
    or the custom player to show up, but sound is there (I've done the
    whole Library>New Video thing, so I have a video object to
    reference).
    My question is: My loaded swf uses #include to include a
    script which imports two classes from a subdirectory, could that be
    causing the problem? My main movie never uses the classes.
    Just want to make sure this isn't my problem before I go
    digging into the script again!

    That is unlikely to be the problem. The .as includes are
    compiled into the
    SWF at publish. Much more likely is that you have
    inappropriate references
    to _root in your loaded movie. As it stands, the scope of
    _root, once you
    load the movie into another, is the _root of the *loading*
    movie. Either
    change these refs, or set the _lockroot property of the mc
    you are loading
    into to true.,
    Remove '_spamkiller_' to mail

  • As 3 load swf flie problem,help

    I have now trapped by a strange problem of loading the swf
    file.For some reason I need to use a main swf file to load other
    swf file and use the class in it,it's very common.
    And now I worte a class blow to explain what problem I met:
    package
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    public class TestClass extends MovieClip
    public var sp:Sprite;
    public static var count:Array=new Array();
    public function TestClass()
    sp = new Sprite();
    //drawcrr();
    this.addEventListener("test",test);
    count.push("");
    trace("count in circle is:", count.length);
    private function test(e:Event):void
    drawcrr();
    public function drawcrr():void
    sp.graphics.beginFill(0);
    sp.graphics.drawCircle(0,0,10);
    sp.graphics.endFill();
    addChild(sp);
    Save it as TestClass.as for next use;
    Use the class to link to a fla file as the documentClass then
    compile as a swf file name as
    kk.swf then make a copy name kk1.swf;
    Create a new fla file in the same directory then write the
    code blow on the mainTimeLine :
    var kk:TestClass = new TestClass();
    var URL1:URLRequest = new URLRequest("kk1.swf");
    var URL2:URLRequest = new URLRequest("kk.swf");
    function domain():LoaderContext
    var context:LoaderContext = new LoaderContext();
    context.applicationDomain = new
    ApplicationDomain(ApplicationDomain.currentDomain);
    return context;
    var L1:Loader = new Loader();
    L1.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete);
    L1.load(URL1);
    var L2:Loader = new Loader();
    L2.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete);
    L2.load(URL2);
    //v.text = flash.system.Capabilities.version;
    function onComplete(e:Event)
    trace(e.target)
    then compile this fla file you will find the flash will put
    out below:
    count in circle is: 1
    count in circle is: 2
    count in circle is: 3
    [object LoaderInfo]
    [object LoaderInfo]
    and if you notation the line "var kk:TestClass = new
    TestClass();" compile it again
    the flash will output :
    count in circle is: 1
    count in circle is: 1
    [object LoaderInfo]
    [object LoaderInfo]
    It's prove that the same class in the different swf was
    loaded by a main swf file,the same class in the different swf file
    will be treated as the different class so that I can use them
    individually but when I put the code:"var kk:TestClass = new
    TestClass();" in the main swf file all this will be break down,I
    can't use the class in kk.swf and class in kk1.swf individually
    the flash make then as the same class because the static
    variable "count" was count to 3.
    it prove that all those 3 swf file will use the exactly same
    class;So, that's the problem,it will make my programme cause error.
    Can some one kindly to tell me why this happened?And how can
    I solve this problem.

    Sorry about that.
    That problem is:
    If I use a shell swf to load some swf file and the shell swf
    and the loaded swf file have the same name class,The loaded swf's
    class will be ignored.
    That will make me can't use the loaded swf file's class which
    have same name with the shell swf.
    However, this problem can be solved by useing the application
    domain.Just give the swf you loaded a new application domain in the
    shell swf.
    But after that I found a new problem appear in front of mine,
    that is:
    If I use the different application domain in my shell swf how
    could they communicate with each other?
    For example:
    If my shell swf have a class named TEST,and the loaded swf
    also have the same name class those two classes both extends the
    class named TESTParent and the TESTParent have a public static
    variable to count the instance of the class.If I want use those two
    TEST
    class individually and at the same time made the static
    variable in the TESTParent count work as a same class how can I do?

  • Control main timeline from loaded swf.

    Hi,
    I'm using a textfield for debug information.
    I'm loading an swf on the main timeline and I'm showing the status in the debug textfield.
    function swfLoaderCompleteHandler(event:Event)
         Debug.text +=  "Swf loaded.";
    That works.
    But,
    I'm loading a png file in the loaded swf. , I'm trying to show the status of the png file as I showed the status of the swf.
    function pngLoaderCompleteHandler(event:Event)
         MovieClip(parent).Debug.text += "Png loaded.";
    I can't control the main swf from inside the loaded swf. Even gotoAndStop or calling a function doesn't work.
    Do I need to add something when I load the swf, saying it's a MovieClip or something?
    Here's a fla too. http://flashfocus.nl/forum/attachment.php?attachmentid=9885&d=1282509233

    Thank you! you're brilliant!
    For people with the same problem:
    If you use CS5 and you have a TLF text on the stage, it doesnt work... I think it's a bug. But when I converted my TLF textfield to classic and everything works fine!

  • Pass parameters to a function in main class from loaded SWF?

    I've got a main.as that loads SWF to the stage.
    the loaded SWF seppoused to pass a link to the main.as and trigger a javascript function to popUp that photo from that link.
    I know there are two ways:
    ((root as MovieClip).parent.parent as Object).somefunction(parameters);
    and to dispatch an event.
    inorder to pass parameters throug the event i need to extend it with another class.
    isnt the (root as... )  more efficient if all i need is to pass a link?

    when a photo from the gallery is selected a javascript popUp shows it enlarged with additioan editing options (kinda like in facebook).
    in that popUp ther is also a next button so its kinda bidirectional. (the next calling the loaded SWF throug main to get the next link in the photo array)
    the photo is a grandchild of a grandchild of the stage and the loaded swf is a grandchild so using:
    ((root as MovieClip).root as MovieClip).ExternalInterface.call("ShowPic", link);
    is discusting ><

  • Calling Flex function from loaded SWF

    Hello,
    I need to load an external SWF file, wity ability to call functions from the base FLEX code script .
    Is that possible ? noting that the loaded SWF can be either in AS2 or AS3
    Thanks in advance ..

    There are some third party ways of talking to an as2 swf.  Google
    as2interface (or maybe as3interface)

  • AIR load swf cash problem

    hi folks
    I am building android app.
    I have a problem with loading several .swfs cache. this swf-s have almost same package and class structure/ names.
    App stores ActionScript and assets of first loaded swf and when i try to load second swf, anyway it loads first swf.
    I used
    request.cacheResponse = false;
    request.useCache = false;
    loader.unload();
    loader.unloadAndStop();
    loader = null;
    but no luck, any solutions, suggestions?
    thanks

    I solved problem, swfs that I loading in app have same package names and classes, I changed package names for each swf and everything works fine.
    Main app stores in cash loaded swf-s AS code, I have't found solution how to clean this cash

  • Extracting array from loaded xml

    I'm using Flex 4 in an AIR project and need to load the following xml text file
    <list>
        <month name="Jan-04" revenue="400263" average="80052">
            <region name="APAC" revenue="46130"/>
            <region name="Europe" revenue="106976"/>
            <region name="Japan" revenue="79554"/>
            <region name="Latin America" revenue="39252"/>
            <region name="North America" revenue="128351"/>
        </month>
        <month name="Feb-04" revenue="379145" average="75829">
            <region name="APAC" revenue="70324"/>
            <region name="Europe" revenue="88912"/>
            <region name="Japan" revenue="69677"/>
            <region name="Latin America" revenue="59428"/>
            <region name="North America" revenue="90804"/>
        </month>
    </list>
    The original example (the old Flex 2 Dashboard example) used
       <mx:HTTPService id="srv" url="results.xml" useProxy="false" result="resultHandler(event)"/>
    to load the xml file, then used the line:
                monthData = event.result.list.month.source as Array;
    to convert the text to an array. Since this is an AIR project I'm using Filestream etc. to load the file but cannot convert it to an array. Not sure why. Here is the filestream code:
    private function loadFile():void{
    var file:File = File.applicationDirectory.resolvePath("results.xml");
    var fileStream:FileStream = new FileStream();
    fileStream.open(file, FileMode.READ);
    var xmlList:XML = XML(fileStream.readUTFBytes(fileStream.bytesAvailable));
    fileStream.close();
    monthData = xmlList.month.source as Array;
    trace(monthData);
    but the trace is always null no matter what I try.

    Ignore all the httpService vs Filestream, the xml seems to be loading ok but I can't extract the array from the xml. The original example was from Flex 2 so I'm not sure if something has changed but the original
    monthData = xmlXML.month as Array;
    doesn't work. The xml seems fine as I can extract anything from it.
    trace(xmlXML.month[2].region[0].@name);
    I just can't turn it into an Array like in the original.

  • Getting properties from loaded swf

    hi there,
    I am loading different swfs into my loader object "loader"
    and I also have a description of each swf below it ("desc"
    "desc_back").. Each swf is different in size and i want to move/
    scale "desc" and "desc_back" it to fit. This seems to be kind of
    working but it changes to fit the loaded swf before the one I want
    it to. it is if it is taking the properties of the last loaded swf
    instead of the one just loaded...I have tryed using an onload
    listener amoung a number of things. my action script is not very
    strong so it could be something simple.
    thanks :)

    you must wait until loading is complete before trying to
    access the _width and _height of the about-to-be-loaded swf. ie,
    use preloader code or the onLoadInit() method of the
    moviecliploader class.

  • Accessing AIR API from loaded SWFs

    I am relatively new to AIR development and I can't get my head a round a little issue. I have an AIR application created in Flash CS5 that is just a shell that loads modules on demand, those modules are just SWF.
    I would like to access the AIR API directly from the classes of those SWF but of course they don't compile because in the publish settings they are just exported for Flash player 10 and don't see the AIR API. I tried adding airglobal.swc to the library hoping it would sort out the compiling problem but it doesn't and it generates many errors.
    I use to develop with MDM ZInc and I would just import the MDM SWC in any classes that would want access the MDM API, I am unsure how to proceed with AIR.
    Any help would be appreciated.
    Calwen

    Hi Calwen,
    here is basic sample how you could achieve that. Note: I'm using mxml syntax and components - but the *KEY* is api use of LoaderContext - not what real components are used to model UI.
    Say I have host:
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                                xmlns:s="library://ns.adobe.com/flex/spark"
                                xmlns:mx="library://ns.adobe.com/flex/mx"
                                creationComplete="creationCompleteHandler(event)">
         <fx:Script>
              <![CDATA[
                   import mx.events.FlexEvent;
                   protected function creationCompleteHandler(event:FlexEvent):void
                        var loaderContext:LoaderContext = new LoaderContext();
                        loaderContext.allowCodeImport = true;
                        swfLoader.loaderContext = loaderContext;
                        swfLoader.load("app:/MyLoadedApp.swf");
              ]]>
         </fx:Script>
         <s:SWFLoader id="swfLoader" width="100%" height="100%"/>
    </s:WindowedApplication>
    MyLoadedApp is not created with air SDK at all - it is just flash.display.Sprite movie clip created with any compatible Flash compiler:
    package
         import flash.display.Sprite;
         import flash.events.*;
         import flash.text.TextField;
         import flash.utils.getDefinitionByName;
         public class MyLoadedApp extends Sprite
              public function MyLoadedApp()
                   addEventListener(Event.ADDED_TO_STAGE, initApp);
              protected function initApp(addedToStageEvent:Event):void
                   removeEventListener(Event.ADDED_TO_STAGE, initApp);
                   var clazz:Class = flash.utils.getDefinitionByName("flash.filesystem.File") as Class;
                   if(clazz)
                        // we could read documents directory (File.documentsDirectory) using class access
                        var directory:Object = clazz.documentsDirectory;
                        try
                             // and we could show browse dialog (now we are using instance - not class)
                             directory.addEventListener(Event.SELECT, directorySelectedHandler);
                             directory.browseForDirectory("Please select directory");
                        } catch (error:Error)
                             // handle error
                             var errorText:TextField = new TextField();
                             errorText.autoSize = "left";
                             errorText.text = error.message;
                             addChild(errorText);
              protected function directorySelectedHandler(selectEvent:Event):void
                   var directory:Object = selectEvent.target;
                   var files:Array = directory.getDirectoryListing();
                   var resultsTextField:TextField = new TextField();
                   resultsTextField.autoSize = "left";
                   resultsTextField.multiline = true;
                   resultsTextField.appendText(selectEvent.type+":\n");
                   for(var i:uint = 0; i < files.length; i++)
                        resultsTextField.appendText(files[i].name+"\n");
                   addChild(resultsTextField);
    This is not safe at all and loaded module can do everything I think (we talk about local modules from app storage, like in Zinc, right?)
    kind regards,
    Peter

  • Creating array of Bitmaps from loaded swf

    so ive got a swf, quite simply it contains an embedded Video
    object, an flv. what i need to do is load it in (done) goto each of
    its frames in turn and convert said frames to Bitmaps, thus
    creating a single, unique Bitmap for each frame of the flv Video.
    crikey, how the hell can i do this? :)

    so i've just discovered that, as someone on some webpage
    somewhere said 'BitmapData is your friend. having discovered this i
    found the answer. the code's a bit rood, just test code crudely
    c&p'ed but heres what seems to be the broad answer to my own
    question:
    private function completeHandler(event:Event):void
    var mc:MovieClip = MovieClip(loader.content);
    mc.gotoAndStop(1);
    var bmd1:BitmapData = new BitmapData(320,240);
    var bm1:Bitmap = new Bitmap(bmd1, "auto", true);
    bmd1.draw(mc);
    mc.gotoAndStop(1000);
    var bmd2:BitmapData = new BitmapData(320,240);
    var bm2:Bitmap = new Bitmap(bmd2, "auto", true);
    bmd2.draw(mc);
    addChild(bm1);
    addChild(bm2);
    bm2.y = 240;
    }

  • Files imported into Project from hard drive - big problem

    I am a new user of Aperture (v2.1), having been a Lightroom user. I had lots of files on my hard drive organized by year and subject.
    I imported them into separate new project folders (choosing the option of leaving them in their current location when importing). All looks great in my project folders when I am in Aperture, and everything is where it should be.
    Now here's the problem . . . when I use Finder and look into the folder the images were stored in, the folders are still there with the photos still inside, but now there are many individual file folders, each with one image inside (RAW) . . . so, say I had 50 raw images in my original folder on my hard disk, I now have that folder and 50 other individual folders, each with the file name of the one image that is inside the folder. As you can imagine, this is using up a lot of disk space.
    I hope someone can help with this. I figure I am doing something wrong, but in searching for answers, I could not find anything about this problem.
    Thanks in advance for any help on this.
    Kathy Nelson

      Have you tried searching for something like IMG_1234.jpg
    Or your regular file name format.
     

  • Initial Load Setup...Potential Big Problem

    Hi All,
    I think we have a big problem.  I have posted a similiar question before, but answers are confusing to me.  Let me explain our current situation and please comment.
    1. We are loading billing documents, thus using VDITM.
    2. We have 2 number ranges for billing documents.
    3. On R3 we filled the setup tables with the smaller number of billing documents.  Then in BW ran a full load.
    4. The second billing document number range was kicked off in R3 and setup tables filled.
    5. Now, here is where I think there is a problem.  This second and final load from the setup table was setup and ran as a full load on BW.  Shouldn't this have been the Delta Init?
    Please comment on this:
    I believe this second load should be the delta init.  Then after this was done schedule the RMBWV313 job in R3 to run, for us, hourly.  In BW schedule the daily delta to run at night (for us).  Everything is in sync this way.
    My concern is the second setup table load from BW was setup as a Full Load.  After this load is done can we just schedule RMBWV313 in R/3 to run hourly and then schedule the Daily Delta in BW to run later that night.
    Please comment asap...please.
    Appreciate it,
    Mike

    Hi Mike,
    You may be okay!  You can run the Init Delta InfoPackage in BW <i><b>without</b></i> transferring data, and your delta process would then be set up.  If you have the means, check your data in R/3 and verify in BW after a couple of days (couple of delta extracts) to make sure your billing totals match.
    The setup tables are only good for doing your initial load (or full load). 
    Your other solution would be to delete the second full load in BW, fill your setup table with the second range again (to get the new billing data), and then run the Init Delta InfoPackage in BW <i><b>with</b></i> data transfer, and you should be set to go.
    Let us know if you succeed!

  • Is it possible to load SWF files from an SQL database?

    Hi all, I am very new to flash (I am primarily a C'# developer!) and I have been asked to investigate the possibility of doing the following;
    Create an application that allows swf files to be uploaded and stored inside of a SQL database as binary data (Why a database is a long story!)
    Allow this binary data to be extracted via a http request to be dynamically loaded inside of a web page.
    Now the first part was easy. I have all of my swf's uploaded and stored inside of the database. I have code that can make a request for the binary and write it to the response, so far so good. Now this is where I am stuck.
    I thought I could dynamically load the swf binary data by creating a very basic swf that simply contains a movie clip holder and for now a simple loadMovie statement. My idea being that I can could provide a url for the loadMovie statement that returns the swf binary data. This is where I have ground to a halt.
    I can see the call being made from the swf, I can see the data being returned but I cannot get it to render. I remember seeing an article some time agao where someone stated that they had used this method with success but I cannot find now. Has anyone ever done anything like? Is it even possible? Am I missing something simple?
    I have tried to return both the raw binary data and also used response.write but to no avail. Can anyone help?

    You are possibly trying to load AS3 swf into an AS2 Container at least the use of loadMovie() points in that direction. Be sure to use AS3 and target at least Flash 9 in your Loader/Main.swf. Also the AS3 concept of how to load swfs  differs a lot from the old concept.
    Look into the docu:
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Loader.ht ml
    But the biggest Problem seems to me -what you mentioned- that Loader needs a (defined) URLRepuest and since your swf files have no "real" URL and you surely don`t want to let the user directly write to your server, a workaround would be to write the BinaryStream with AIR-functionality to a local installlation directory and load it then from there.

Maybe you are looking for