Flash swf componrnt button color changing by flex script

i have a swf button created in flash which is used in flex.
the button has got an arrow which is initially black, now i have to
change the color of that arrow dynamically. i know flex a little
bit but dont know flash.
i have the source - fla - file of the swf too, where there is
a button symbol - the arrow - in the library, but i dont know how
to access that symbol from flex and change its properties.
thanks in advance.

Small detail:
because you are embedding the swf as a whole, the datatype of
content is MovieClip. So with your code you are downcasting the
datatype to DisplayObjectContainer. The inheritance chain:
MovieClip -> Sprite -> DisplayObjectContainer ->
InteractiveObject -> DisplayObject -> EventDispatcher ->
Object
Your code works because 'transform' is an inherited public
property of DisplayObject. But if you needed a method like
gotoAndPlay() the downcast to DisplayObjectContainer would prevent
this since gotoAndPlay() is a member of the MovieClip class.

Similar Messages

  • Flash SWF (with as3 code) integrate in Flex probelm

    Hello everyone,
    I'm having a problem to make my Flash SWF working in Flex. I
    created an animation movieclip, made a button and wrote a script to
    play this movieclip in Flash. Everything works fine but when I use
    SWFLoader in Flex to integrate this SWF in my application. This
    "play" button is working anymore in Flex.
    Should I remove the button and script in Flash and put them
    in Flex? How could I write the script in Flex to call a function to
    play this SWF?
    Is there any other way to solve this problem?
    Thank you in advance.

    "Smile2JP" <[email protected]> wrote in
    message
    news:gmqtde$fbi$[email protected]..
    > Hello everyone,
    >
    > I'm having a problem to make my Flash SWF working in
    Flex. I created an
    > animation movieclip, made a button and wrote a script to
    play this
    > movieclip in
    > Flash. Everything works fine but when I use SWFLoader in
    Flex to integrate
    > this
    > SWF in my application. This "play" button is working
    anymore in Flex.
    >
    > Should I remove the button and script in Flash and put
    them in Flex? How
    > could
    > I write the script in Flex to call a function to play
    this SWF?
    > Is there any other way to solve this problem?
    I have an example on my blog that demonstrates controlling a
    Flash movie
    from Flex:
    http://flexdiary.blogspot.com/2009/01/example-of-casting-contets-of-swfloader.html
    I included links to more basic examples in the code, so you
    might find one
    of them helpful even if this isn't.

  • Buttons Color Changed

    This may sound like I don't understand button states or whatever, but every time I convert an image to a button and preview the menu the button isn't the color I created it. I open the menu in Photoshop and there are no layers that should be causing this. What is Encore CS3 doing to buttons and how do I edit or stop it? All I want is to have the buttons show up the color I create them not some hue shift that ruins my color scheme.

    Hi Ruud,
    Yes, i have no doubt watching the tutorial movie would help.
    If fact, last night before posting this topic to the forum I did a search and came up with the topic with the link to the movie,
    but after downloading the movie Windows Media Player says it is missing an audio codec it needs to play the movie and when clicking the Web Help button the page only tells me WMP is having a problem with the file (not all that helpful).
    I thought I'd import it into Premiere but it seems to be an unsupported format.
    So for the time being, I'm a bit stuck with the file.
    I have a month's membership with Lynda.com and have been watching the Encore CS3 movies but haven't gotten what I need yet.
    I am going to continue and most likely something there will click for me.
    I had the problem last week and one of the check mark selectors cleared it up, but nothing seems to work on this project.
    It seemed to be related to a feature that was kind of like a visited link color change.
    Any further help is appreciated,
    Don

  • Background color change on Flex builder editor

    I have been searching around to see if there is a way to
    change the editor's backgorund. After long hours of coding, the
    white background hurt my eyes.
    I know wehre ti change the text color, and the background
    color of the console, but not the editor (source). Any idea?

    hi
    if you are using flex builder 3 you go to to:
    window->preferences
    then select General and inside it select Editors
    Inside editors you have Text Editors, select that and you
    will see what you want.

  • Flex swf loaded in Flash swf

    Hi,
    I have a Flex swf loaded into a Flash swf.
    I have made the Flex swf transparent, so that the buttons in the Flash swf are visible.
    But im unable to interact with the Flash swf buttons.
    My Flex swf is working happyily
    The Flex swf overlays the Flash swf.
    If i change the scrollRect of the Flex swf so the Flex swf is not overlaying the Flash swf i can successfully interact with the Flash swf buttons.
    Any ideas?
    Regards,
    Kyle

    Thanks Alex,
    I actually found an old post on a forum where you recommended a similar solution (mousesheld.visible = false).
    This seems to work although it messes with dragging (my Popups at least).
    But i can work with that for now, thanks for your help.
    Regards,
    Kyle

  • New to flash, swf loaded while changing size

    i'm trying to create a button that will replace the current
    swf with another and i want the size to change between the various
    sizes of each page. i'm currently using the following code in the
    action inspector:
    on(release){loadMovieNum("myfilename.swf",0);
    i know there has to be a simple way to do this! a very
    grateful thanks to anyone who tries to help!

A: new to flash, swf loaded while changing size

b3autiful_dizaster wrote:
> i'm trying to create a button that will replace the
current swf with another
> and i want the size to change between the various sizes
of each page. i'm
> currently using the following code in the action
inspector:
>
> on(release){loadMovieNum("myfilename.swf",0);
> }
>
> i know there has to be a simple way to do this! a very
grateful thanks to
> anyone who tries to help!
You can't change size dynamically as it is defined by the
object embed tags.
You could use WMODE transparency which could help you fake it
tho not always best
solution to go with WMODE. It's a very buggy parameter.
WMODE will remove the background color so the flash movie
appear over the html and you
can see the HTML content trough the movie.
You could define some solid shape for the background on
bottom layer to make it look
like SWF background, than change it with the other loaded
movie making it appear as it
changed size while the over all flash size stats the same. As
said above - faking it.
Best Regards
Urami
!!!!!!! Merry Christmas !!!!!!!
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami>

b3autiful_dizaster wrote:
> i'm trying to create a button that will replace the
current swf with another
> and i want the size to change between the various sizes
of each page. i'm
> currently using the following code in the action
inspector:
>
> on(release){loadMovieNum("myfilename.swf",0);
> }
>
> i know there has to be a simple way to do this! a very
grateful thanks to
> anyone who tries to help!
You can't change size dynamically as it is defined by the
object embed tags.
You could use WMODE transparency which could help you fake it
tho not always best
solution to go with WMODE. It's a very buggy parameter.
WMODE will remove the background color so the flash movie
appear over the html and you
can see the HTML content trough the movie.
You could define some solid shape for the background on
bottom layer to make it look
like SWF background, than change it with the other loaded
movie making it appear as it
changed size while the over all flash size stats the same. As
said above - faking it.
Best Regards
Urami
!!!!!!! Merry Christmas !!!!!!!
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami>

  • Load time issues FLEX swf vs. FLASH swf

    Hello,
    We are building FLex and Flash apps running on Flash 10.1.  In our situation, the load time for a 1080x768 swf is slower when building in Flex than in flash.  We have tried useing the preinitialize event to set at least a loading message, but the delay happens before the preinitialize event.  It seems to take 1-2 seconds to load the FLex API perhaps?  The only visula we can see is the background color of the stage.  Even with a simple nearly empty main canvas, the load is slow enough to be noticable.  More importanly it is faster when using a FLASH swf ( or pure AS3), so it must be related to the FLex aspect.  Is there anyway to cache the common classes or maybe exclude some that are not used?
    Thanks,
    Jeff Schuenke

    The main point of RSLs is to gamble on improving download time of the SWF at
    networks speeds.  The gamble is that someone has already loaded the RSL so
    it gets picked up off the browser cache at hard-drive speeds.  If it isn't
    true, you pay a higher penalty because you are loading an RSL that has code
    in it you aren't using.  That's why the total payload is more.  For the
    record, only the SWF or the SWZ gets loaded, not both.  But even then the
    total payload would be more.
    At home, my DSL/WIFI network gets me about 70KB/sec, so saving 300K would be
    a noticable savings.  If you are loading off a hard disk, 300K probably
    won't be felt.
    The startup sequence of a SWF over a network (http or https):
    -start streaming in SWF bytes
    -when the first frame is downloaded (generally about 80-100K) see how many
    bytes are left to download and if there is a lot, show a progress bar
    -load any RSLs and wait for their download and initialization
    -update the progress bar until the rest of the SWF downloads
    -after the SWF downloads:
        -initialize styles
        -initialize resources
        -prepare embedded fonts
        -setup managers for popups, tooltips, dragging if needed
        -instantiate Application
            -verify and initialize all classes needed by Application
            -dispatch Application preinitialize
            -instantiate the initial set of children for the Application
            -dispatch Application initialize
        -update progress bar to show "initializing"
        -start validation of Application and its children
        -continue to do so until all children are measured and layed out
        -dispatch Application creationComplete
        -add Application to stage (actually systemManager)
        -dispatch Application applicationComplete
    The startup sequence of a SWF on a hard drive is different.  The entire SWF
    must be sucked into memory, unzipped (SWFs are zipped by default) and only
    then do we get to the steps where we show a progress bar, check for RSLs,
    etc.
    At 3MB, there might be a noticeable hit.  You can find a big image file and
    zip it to see if it comes out to about 3MB.  Then use the file system to
    copy it and see how long that takes and then unzip it and see how long that
    takes.
    Another place that causes delay is in the validation of children.  If the
    children's size are not stable right away (because data is coming in that
    affects their size) then several validation passes might be taking place.
    A common error is to create every child in the app, even ones that aren't
    seen or needed right away.  That adds work at validation time and delays the
    startup process.
    I would recommend that you use the performance profiler in Flex Builder to
    see where all the time is being spent.
    However, 3MB is a big SWF. Use of modules to chop off stuff not needed until
    "later" is recommended and will probably be the answer.

  • How to create a radio button that changes colors

    I'm using Acrobat X and ID CS5 on Mac OS X.
    A couple of years ago someone on the forums explained to me how to create a button that changes color with each click. You can view a sample PDF at https://dl.dropboxusercontent.com/u/52882455/colorcycle.pdf. They gave me the document JS and showed me how to set the properties of the button. I've integrated the button into a particular series of PDF forms and it's worked out very well.
    Now I would like to do the same thing, but using a circle instead of a square. Can anyone tell me the best way to do this? Can I somehow set a radio button to cycle through colors in the same way? I design my forms initially in ID CS5 and then activate and format the fields in Acrobat X. I've tried using circles instead of squares in my ID document, but when I export to an interactive PDF, they're converted to squares.
    Any ideas?

    I understand how to make buttons cycle through colors-- the problem I'm having is that I'm trying to figure out how to make a circular button cycle through colors. When I export my ID document to PDF, my round button maintains it's original appearance, but when I click on it to cycle through the colors, it behaves like a square (see new PDF at https://dl.dropboxusercontent.com/u/52882455/colorcycle2.pdf).
    If I use a radio button, I can get it to cycle through colors, but I don't want it to have a black dot in the middle. Is there a way to format the radio button to not show the black dot when clicked?

  • How to change button colors in a loop?

    I am working on a task that should imitate an elevator. I have two vertical
    rows of round buttons "Up" and "Down" When a circle is selected randomly by
    the program, the circle becomes yellow and the elevator moves to that
    button.
    Here is what I did:
    1. created a class Circle where I save buttons' parameters
    2. saved Circle objects in an array
    3. drew the buttons depending on their parameters
    4. generated a random number, matched it with an array index and assigned
    the object color to yellow.
    Everything is fine except that I can't figure out how to change colors of my
    buttons in a loop.
    import javax.swing.*;
    import java.awt.*;
    import java.util.*;
    public class Elevator3 extends JPanel
    private int n = 40;
    private int width = 200;
    private int floors = 10;
    private int interval = 1000;
    private boolean selected = false;
    private Circle[] buttons = new Circle[2*(floors-1)];
    public Elevator3()
    build();
    JFrame frame = new JFrame("Elevator3");
    setBackground(Color.WHITE);
    setFont(new Font("SansSerif", Font.PLAIN, Math.round(n/3)));
    frame.getContentPane().add(this);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(width, n*(floors+2) );
    frame.setVisible(true);
    public void build()
    Random r = new Random();
    int buttonPick;
    int timeUntilNextButton = r.nextInt(interval);
    for (int k =0; ; k++)
    if (timeUntilNextButton-- ==0)
    buttonPick = r.nextInt(2*(floors-1));
    //populate my buttons array here - how??
    timeUntilNextButton = r.nextInt(interval);
    //adding "Down" buttons
    for (int i=1, count=0; i < floors; i++, count++)
    if (count == buttonPick)
    selected = true;
    else
    selected = false;
    buttons[count]= new Circle(n*2, n*i, selected, Math.round(n/2));
    //build an array of "Up" circles
    for (int i=2, count=floors-1; i < floors+1; i++, count++)
    if (count == buttonPick)
    selected = true;
    else
    selected = false;
    buttons[count]= new Circle(n, n*i, selected, Math.round(n/2));
    public static void main(String[] args)
    new Elevator3();
    protected void paintComponent(Graphics g)
    super.paintComponent(g);
    //draw buttons
    for (int i=0; i < buttons.length; i++)
    g.setColor(buttons.getColor());
    g.fillOval(buttons[i].getX(), buttons[i].getY(), buttons[i].getWidth(), buttons[i].getWidth());
    class Circle
    private int x;
    private int y;
    private Color c;
    private boolean pressed;
    private int width;
    public Circle(int xCoordinate, int yCoordinate, boolean selected, int diameter)
    x = xCoordinate;
    y = yCoordinate;
    pressed = selected;
    width = diameter;
    if (pressed)
    c = Color.YELLOW;
    else
    c = Color.LIGHT_GRAY;
    public Color getColor()
    return c;
    public int getX()
    return x;
    public int getY()
    return y;
    public int getWidth()
    return width;

    hi,
    am sorry, i couldn't make out what exactly the problem, but as ur subject line says...
    may be the code give below will help you to change button colors in a loop..
              for(int i = 0; i < button.length; i++){
                   int color1 = (int)(250*Math.random());
                   int color2 = (int)(250*Math.random());
                   int color3 = (int)(250*Math.random());
                   Color c = new Color(color1,color2,color3);
                   button[i] = new JButton("button name");
                   button.addActionListener(this);
                   //to check the r, g, b combination.
                   //System.out.println(c);
                   button[i].setBackground(c);
                   button[i].setForeground(Color.white);
    //adding into the panel
                   panel.add(button[i]);
    hope this would help you.

  • Making a color changer in Flash?

    If anyone can help me. I'm trying to do something similar to
    this color selector.
    http://www.chevrolet.com/silverado/colors/
    Using simple code I can make the colors change, I just don't
    know how they made the "wipe" or any other transition for that
    matter when changing color.
    any ideas?

    "Mr_Interweb" <[email protected]> wrote in
    message news:e43qn9$obc$[email protected]..
    >I have no idea what's up with that loader. I tried it out
    on 6 different
    > computers today on windows and mac. It was working this
    afternoon. The only
    > thing I can find is that my loader is getting cached in
    IE when I cleared out
    > the cache things worked fine. If things are still fishy
    after a cache clear or
    > trying in out in Firefox, try skipping the preloader:
    >
    >
    http://ultimatewindowtinting.com/tinting-tool/tinter.swf
    >
    > The app will scale weird in the browser without the
    loader, but you can at
    > least see it.
    >
    > By the way, thank you for telling me about the errors
    you found with that
    > loader. It is the most bizarre issue I have ever seen.
    That's very interesting how you got that color selector to
    work. good one!
    I took a look at the code in your preloader. One thing that
    is not right is that you are looping back to frame 2 where the
    onEnterFrame is created. That means that you are creating
    another onEnterFrame with every loop, (or wrecking the original
    one).
    I found that if I put your file tinter.swf in my cache, then
    the preloader ended and the main file ran. If tinter.swf wasn't in
    the
    cache then the preloader just gets stuck.
    Seems like the loadMovieNum is failing.
    Anyway, instead of that you might want to do something like
    this to make sure that you don't initialize onEnterFrame more than
    one
    time..
    if(!initialized)
    initialized = true; // block this init code next time
    loadMovieNum("tinter.swf", 2);
    this.onEnterFrame = function () // add 'this' here
    ... etc
    tralfaz

  • How to set up one-button embed-hotlinking for Flash SWF?

    Hello,
    I'm publishing a webcomic in Flash.swf format and I'd like to make it as easy as possible for people to grab my comic and put it on their website. How can I set up one-button hot-linking that will automagically provide the code so that they can easily drop it into their website, similar to the way YouTube does with video?
    Thanks,
    Tom

    you can use the following.  the bolded lines require you to use appropriate values:
        <div id="flashContent">
                <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="yourswfwidth" height="yourswfheight" id="swfname" align="middle">
                    <param name="movie" value="http://www.yourdomain.com/path/swfname.swf" />
                    <param name="quality" value="high" />
                    <param name="bgcolor" value="#ffffff" />
                    <param name="play" value="true" />
                    <param name="loop" value="true" />
                    <param name="wmode" value="window" />
                    <param name="scale" value="showall" />
                    <param name="menu" value="true" />
                    <param name="devicefont" value="false" />
                    <param name="salign" value="" />
                    <param name="allowScriptAccess" value="sameDomain" />
                    <!--[if !IE]>-->
                   <object type="application/x-shockwave-flash" data="http://www.yourdomain.com/path/swfname.swf" width="yourswfwidth" height="yourswfheight">
                        <param name="movie" value="http://www.yourdomain.com/path/swfname.swf" />
                        <param name="quality" value="high" />
                        <param name="bgcolor" value="#ffffff" />
                        <param name="play" value="true" />
                        <param name="loop" value="true" />
                        <param name="wmode" value="window" />
                        <param name="scale" value="showall" />
                        <param name="menu" value="true" />
                        <param name="devicefont" value="false" />
                        <param name="salign" value="" />
                        <param name="allowScriptAccess" value="sameDomain" />
                    <!--<![endif]-->
                        <a href="http://www.adobe.com/go/getflash">
                            <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
                        </a>
                    <!--[if !IE]>-->
                    </object>
                    <!--<![endif]-->
                </object>
            </div>

  • Change pressed button Color

    Hi,
    I want to change my pressed button Color and I haven't been able to find a way, I tried creating my own button and add a listener when it is pressed and then change its background color but it doesn't work! it works for enter and exit but not for pressed and released.
    any one has an idea?
    thanks
    Here's my code:
    package components;
    import javax.swing.*;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseAdapter;
    import java.awt.*;
    * JButton con una nueva propiedad de Color presionado
    * @author Ana Mar�a Franco
    * @version 1.0
    public class PressedColorButton extends JButton
        // Atributos ************************************************************************
        private Color unpressedButtonColor;
        private Color pressedButtonColor;
        // Constructores ********************************************************************
        public PressedColorButton()
            super();
            this.addMouseListener(new PressedColorButton_this_mouseAdapter(this));
        // M�todos **************************************************************************
         * Obtiene el color sin presionar
         * @return Color
        public Color getUnpressedButtonColor()
            return this.unpressedButtonColor;
         * Define el color sin presionar
         * @param nuevoColor Color
        public void setUnpressedButtonColor(Color nuevoColor)
            this.unpressedButtonColor = nuevoColor;
         * Obtiene el color presionado
         * @return Color
        public Color getPressedButtonColor()
            return this.pressedButtonColor;
         * Define el color presionado
         * @param nuevoColor Color
        public void setPressedButtonColor(Color nuevoColor)
            this.pressedButtonColor = nuevoColor;
        public void this_mouseExited(MouseEvent e)
            this.setBackground(unpressedButtonColor);
        public void this_mousePressed(MouseEvent e)
            this.setBackground(pressedButtonColor);
        public void this_mouseReleased(MouseEvent e)
            this.setBackground(unpressedButtonColor);
        public void this_mouseEntered(MouseEvent e)
            this.setBackground(pressedButtonColor);
    // Escuchadores *************************************************************************
    class PressedColorButton_this_mouseAdapter extends MouseAdapter
        private PressedColorButton adaptee;
        PressedColorButton_this_mouseAdapter(PressedColorButton adaptee)
            this.adaptee = adaptee;
        public void mouseExited(MouseEvent e)
            adaptee.this_mouseExited(e);
        public void mousePressed(MouseEvent e)
            adaptee.this_mousePressed(e);
        public void mouseReleased(MouseEvent e)
            adaptee.this_mouseReleased(e);
        public void mouseEntered(MouseEvent e)
            adaptee.this_mouseEntered(e);
    }

    Swing related questions should be posted in the Swing forum. Try setting the following properties on the button:
    setContentAreaFilled( false );
    setOpaque(true);

  • Flex 4 Embed fonts in flash swf VS embedding fonts in flex

    I have this dilema...what's the best way to embed fonts?
    In flash I can easily embed the fonts + the chars ranges that I need through the menus export the swf and then use it in flex.
    In flex I don't see an easy way of setting the character ranges. How can I get the values I need? I read the format is U+(beginning of range)-(end of range) but where do I take beginning and end of the range from ?
    Thanks in advance.

    Сode hinting in Flash Builder 4 code editor for global style, e.g.
    global {
       font-family : Arial;
    works for me.
    Also in @font-family style declarations, I can code hint for "font-family", "embed-as-cff" styles property too.
    Although, it is true you do not get code hints for values for those particular properties, I think that CSS editor could support it too, but it does not.

  • Is there any way to change the color of the Firefox 4 menu button away from orange? It attracts my attention and as far as I can tell personas change everything but the menu button color.

    Is there any way to change the color of the Firefox 4 menu button away from orange? It attracts my attention and as far as I can tell personas change everything but the menu button color.

    You can change it with the App Button Color extension - https://addons.mozilla.org/firefox/addon/app-button-color

  • I need to create buttons in which the color changes, and stays on after you release the button

    I need to create buttons in which the color changes, and stays on after you release the button. The hard part is the buttons must change independently of each other.
    To get an idea of some of things I’ve tried I’ve tried making the movie with two frames.
    When I click the button it switched to the new frame which would show a movie clip,
    Unfortunately all buttons would change color together and don’t see how to make it so that they change independently.

    you must use movieclip buttons and code for their frame changes.

  • Maybe you are looking for