newb flash question

  • Started
  • Last post
  • 5 Responses
  • attentionspan

    SO OK!

    this is gonna sound stupid, but how do you embed a flash component gallery into a flash file? something like jumpeye...

  • ********
    0

    Open a new flash stage, drag and drop from component library.

  • iceberg0

    If its an Extension you can install it and it becomes available in your panels

  • attentionspan0

    thanks dinky!

  • OSFA0

    Hey peepz, I'm trying to create a slide gallery but got completely lost. I got some of the code that I got as a sample and am trying to edit it to fit what I'm doing.

    This is the code from the sample. It creates 4 buttons and each assign xlocation, but what if I want to use just a prev and next button to do the same??? Thanks!!

    panel.x = 550;
    var targetX:int = 20;
    b1.addEventListener(MouseEvent.C... b1ClickEventHandler);
    b2.addEventListener(MouseEvent.C... b2ClickEventHandler);
    b3.addEventListener(MouseEvent.C... b3ClickEventHandler);
    b4.addEventListener(MouseEvent.C... b4ClickEventHandler);
    panel.addEventListener(Event.ENT... enterFrameHandler);

    function enterFrameHandler(e:Event):void
    {
    panel.x+=(targetX-panel.x)/5;
    }

    function b1ClickEventHandler(e:MouseEvent...
    {
    targetX = 193;
    }
    function b2ClickEventHandler(e:MouseEvent...
    {
    targetX = 20;
    }
    function b3ClickEventHandler(e:MouseEvent...
    {
    targetX = -150;
    }
    function b4ClickEventHandler(e:MouseEvent...
    {
    targetX = -322;
    }

  • armsbottomer0

    i'm not sure how you want the movement increments to work. if its a certain amount in addition to each movieclip's width, could just get the width of the clip and add a number to it:
    mc.width += 50;

    however, if yo need to specify particular coordinates, you could store them in an array and have a counter correspond to where you are in the array. the prev and next buttons would increment and decrement the counter accordingly. the following code may be a buggy, i haven't programmed with AS in a while (and i'm tired ;) ).

    counter:int = 0;
    targetX = new Array("193", "20", "-150", "322");
    next.addEventListener(MouseEvent... changeCount);
    prev.addEventListener(MouseEvent... changeCount);

    function changeCount(e:Event):void{
    if(e.target == next){
    if(counter == targetX.length){
    counter = 0;
    }
    else{
    counter++;
    }
    }
    if(e.target == prev){
    if(counter == 0){
    counter = 5;
    }
    else{
    counter--;
    }
    }
    slideTo();
    }

    function slideTo():void{
    if(counter == num[counter[){
    targetX[counter]= 193;
    }
    else if(counter == num[counter]){
    targetX[counter] = 20;
    }
    //etc....
    }