Welcome, Guest
  • Author Topic: Workflow - Dynamically choose swfs/swcs  (Read 3089 times)

    Mattias Robo

    • Mods
    • Systems Administrator
    • *****
    • Posts: 555
      • View Profile
      • nook
    Workflow - Dynamically choose swfs/swcs
    « on: 04/16/10, 07:35 »
    I'm in the process of planning a banner project, where I want to being able to output all banner formats (about 10+ of them) from the same flex project.

    They will all contain pretty much the same content but with some variation, and because of the size limit I want to load only the necessary assets for each format.

    I wonder if there's a way to dynamically load different assets (in form of swf or swc) depending on some setting? I can of course load different swf:s into the main swf but I want only one swf per banner format.

    How about launch configurations, is there a way to choose different swc:s there?
         "I've figured it out. It's not the fords... it's what's IN them!.."

    papachan

    • Systems Administrator
    • *****
    • Posts: 507
      • View Profile
      • Air Flex Developer
    Re: Workflow - Dynamically choose swfs/swcs
    « Reply #1 on: 04/16/10, 12:32 »
    Are you using Ant to compile your project ?

    Mattias Robo

    • Mods
    • Systems Administrator
    • *****
    • Posts: 555
      • View Profile
      • nook
    Re: Workflow - Dynamically choose swfs/swcs
    « Reply #2 on: 04/17/10, 04:52 »
    No I'm not. Is that what I should use?
         "I've figured it out. It's not the fords... it's what's IN them!.."

    papachan

    • Systems Administrator
    • *****
    • Posts: 507
      • View Profile
      • Air Flex Developer
    Re: Workflow - Dynamically choose swfs/swcs
    « Reply #3 on: 04/17/10, 08:18 »
    Yes,

    We actually use Ant to compile one project who depends from a SVN version number for example.
    But you can use it with different settings like wich RSL library to import, which swc, or which path, or you can write a Compiled Class Config, in your case this class will set the width and the height of your banner.

    ---
    dan

    Mattias Robo

    • Mods
    • Systems Administrator
    • *****
    • Posts: 555
      • View Profile
      • nook
    Re: Workflow - Dynamically choose swfs/swcs
    « Reply #4 on: 04/17/10, 10:45 »
    Ok. That sounds great.

    Yes, the width and height as well as what swc to use is what I need to set.

    I've started reading some articles but is there any place in particular you would recommend an Ant-novice to start looking?

    EDIT: All the examples I've seen is using mxml. But I must be able to use AS3 as well right?
    « Last Edit: 04/17/10, 11:19 by Mattias Robo »
         "I've figured it out. It's not the fords... it's what's IN them!.."

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Workflow - Dynamically choose swfs/swcs
    « Reply #5 on: 04/17/10, 11:56 »
    Where do you wish the dynamic?

    At compiletime, or at runtime?

    All the discussed things are helping you at compiletime.
    Which means, you can compose your target at source level, and then compile it to a swf.

    If you want to do this at runtime, it becomes a little more complicated.
    All dynamic must be defined at compiletime and loaded at runtime.
    Not impossible, but a takes a bit of planing and implementing ;)
    happy flashing
    8)
    Ronald

    Mattias Robo

    • Mods
    • Systems Administrator
    • *****
    • Posts: 555
      • View Profile
      • nook
    Re: Workflow - Dynamically choose swfs/swcs
    « Reply #6 on: 04/17/10, 13:14 »
    Oh. I only need it at compile time. Thanks.
         "I've figured it out. It's not the fords... it's what's IN them!.."

    Mattias Robo

    • Mods
    • Systems Administrator
    • *****
    • Posts: 555
      • View Profile
      • nook
    Re: Workflow - Dynamically choose swfs/swcs
    « Reply #7 on: 04/19/10, 06:28 »
    I'd very much appreciate if you could help me out getting on the right track with this thing.
    I've browsed Ant but haven't found any articles targeting my task directly, and I'm a bit short on time currently.

    So what I need is to be able to compile several swfs, where each of them might differ in the following:
    - width
    - height
    - swc(s) to be loaded

    I don't know if it's possible to compile all different formats on the same time, but at least choosing what swf to compile would be desirable.

    I just realized you can add multiple runnable applications (as-files) in the project properties. But I guess you still can't connect different swc:s to these runnable applications, right?
    « Last Edit: 04/19/10, 08:38 by Mattias Robo »
         "I've figured it out. It's not the fords... it's what's IN them!.."

    papachan

    • Systems Administrator
    • *****
    • Posts: 507
      • View Profile
      • Air Flex Developer
    Re: Workflow - Dynamically choose swfs/swcs
    « Reply #8 on: 04/19/10, 08:33 »
    Well sorry i didnt noticed your messages this weekend. So yes its at compile-time. Maybe it take a little more time to find the solution. Cause Ant works perfectly,  but to use it for some specific actions you will need some Compiled Java file.

    to setting up width and height dynamically=

    Code: [Select]
    <mxmlc file="src/Application.mxml" keep-generated-actionscript="true" output="your_swf.swf">
        <default-size width="800" height="600"/>
        <library-path dir="path-to-swc" append="true">
            <include name="mypath.swc"/>
        </library-path>
    .... etc
    </mxmlc>

    if you need more help i will be looking forward ...


    Mattias Robo

    • Mods
    • Systems Administrator
    • *****
    • Posts: 555
      • View Profile
      • nook
    Re: Workflow - Dynamically choose swfs/swcs
    « Reply #9 on: 04/19/10, 08:41 »
    Ok that's a start at least, thanks.

    Will this work if my project is AS and not MXML?
         "I've figured it out. It's not the fords... it's what's IN them!.."

    papachan

    • Systems Administrator
    • *****
    • Posts: 507
      • View Profile
      • Air Flex Developer
    Re: Workflow - Dynamically choose swfs/swcs
    « Reply #10 on: 04/19/10, 09:40 »
    OK, sorry for the delay i was just testing one ActionScript project with ant, to be sure that it work perfectly.

    there is an exemple build.xml =

    Code: [Select]
    <?xml version="1.0"?>
    <project name="astree" basedir="." default="build">  

    <property name="FLEX_HOME" value="your_path_to_sdk"/>

    <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar"/>

    <property name="swf.name" value="Main.swf"/>


        <target name="build">

       <mxmlc file="src/Main.as" keep-generated-actionscript="true" output="deploy/${swf.name}">
       
       </mxmlc>
    </target>
    </project>


    and here you can download the complete file at :
    http://mutantmaps.com/build.xml


    ---
    dan
    « Last Edit: 04/19/10, 18:49 by papachan »

    Mattias Robo

    • Mods
    • Systems Administrator
    • *****
    • Posts: 555
      • View Profile
      • nook
    Re: Workflow - Dynamically choose swfs/swcs
    « Reply #11 on: 04/19/10, 10:41 »
    Don't worry about the delay, I'm glad you're helping out!

    I would like to have a better question for you but I'm currently stuck with not being able to download Ant from Flex. I'm following a common instruction such as this one: http://www.matthewkerr.com/?p=220

    But when I'm clicking "Finish" after having selected "The Eclipse Project Updates", I get this error:
    "Network connection problems encountered during search."
    In the details it says I can't connect to http://update.eclipse.org/updates/3.3.

    I haven't been able to google my way out of the problem. Do you know what I should do?
    « Last Edit: 04/19/10, 10:43 by Mattias Robo »
         "I've figured it out. It's not the fords... it's what's IN them!.."

    papachan

    • Systems Administrator
    • *****
    • Posts: 507
      • View Profile
      • Air Flex Developer
    Re: Workflow - Dynamically choose swfs/swcs
    « Reply #12 on: 04/19/10, 11:31 »
    You have an error when you are downloading Ant? but ant come with eclipse by default. I dont remember have to downloaded it.

    If you are on a recently version of eclipse, you can look at views panes. just search"Ant panel". and with luck you can drag and drop your build.xml there.

    ---
    dan

    « Last Edit: 04/19/10, 18:47 by papachan »

    papachan

    • Systems Administrator
    • *****
    • Posts: 507
      • View Profile
      • Air Flex Developer
    Re: Workflow - Dynamically choose swfs/swcs
    « Reply #13 on: 04/19/10, 12:01 »
    I dont have the Flex Builder IDE , just the plugin for eclipse, maybe its the problem.


    Mattias Robo

    • Mods
    • Systems Administrator
    • *****
    • Posts: 555
      • View Profile
      • nook
    Re: Workflow - Dynamically choose swfs/swcs
    « Reply #14 on: 04/19/10, 13:33 »
    Yes. Ant comes default with Eclipse but not with Flex Builder.

    But I found one place where the instructions said to download from "Europa Discovery Site" instead of "The Eclipse Project Updates", in contradiction to every other hundred sites. Just tried it and it seemed to work. Weirdo big time!

    So correct me if I'm wrong but what I'll do after I got all files in place, is to drag my build.xml file to the Ant panel and execute all tasks from there (like compile swf nr 2, compile all swfs etc)?
         "I've figured it out. It's not the fords... it's what's IN them!.."