Nov 21, 2009

Flash Action Scripting Help Needed

free web hosting
Open Discussion > MODERATED AREA > Computers > Programming Languages > Others

Flash Action Scripting Help Needed

sonesay
Hey all, I'm working with a art student on this flash based portfolio site and it requires some complicated action scripting. Either him nor I are efficient enough in flash so we need some advice from you experienced Flash experts out there. I worked with flash a long time ago and it was only on one project so I remember vaguely what movies and time lines are for lol. Basic stop and go to commands but that's about it. I can read up on anything I need but the thing is I have no idea where to begin.

I have attached a PDF of my partners initial storyboard of the scenes. The first initial screen is of items in the portfolio. I'm assuming this will be scrollable since you cannot fit all the items on the screen if there are many. Also spacing between them has to be applied when highlighted.

I hope someone can give me some pointers on how to go about it. I am not looking for a "Go search google" answer lol because I have tried and I cant find anything specific to moving items in a scrollable context. I need advice from someone who can do this so I can save a bit of time trying to find things out on my own.

Thanks in advanced
Sone.

 

 

 


Comment/Reply (w/o sign-up)

Nabb
Okay I'll give you the general idea, but you'll still have to google tongue.gif What I'm trying to do is give you the basic concept on how to go about this, with some code tips.

Firstly I'm going to use ActionScript 2.0, so if you want AS3.0 then find someone else..
It's designed to be all in one frame.. I suggest reading through my entire post first!
Also I don't remember how masks work, so I'm going to go about it a different way!
If there's any problems with scope, then oops, and ask tongue.gif
Lastly I'm doing this off the top of my head, so any syntax errors in the example code you'll have to fix yourself.


Each button is a movie clip, a grey rectangle with a text-box. There should be one movie-clip which is the grey rectangle and used in each button.
The page to be displayed is a movie clip, which has each page on an individual frame.

On the movie clip (place it on screen, and the click on it and go to the actions panel), what you need is:
CODE
on(MouseOver){ stuff }; on(MouseOut){ morestuff }; function fadein(){ instuff }; function fadeout(){ outstuff }; on(MouseDown){ clickstuff }; movedown(){ downstuff }; moveup(){ upstuff }; checkover(yp){ overstuff }


What 'stuff' should have:
You should set an interval that calls fadein().
For example: ininterval = setInterval(fadein, 100); //which would call fadein() 10 times a second
I want to define a variable, I'll come back to this later. Briefly.
For example: pie = true;

What 'morestuff' should have:
You need to clear the interval calling fadein(), and then set an interval for fadeout().
For example: clearInterval(ininterval); outinterval = setInterval(fadeout, 100); //calling fadeout() 10 times a second.

What 'instuff' should have:
Change the colour of the the grey rectangle:
For example: this.greyrectangle._alpha -= 2; //which reduces the alpha by 2, 10 times a second.
We need to change the colour of the text, what you can do is have the text white and increase the alpha to make it visible:
For example: this.textbox._alpha += 5; //so it'll be fully visible after 20 calls, i.e. 2 seconds.
We need to check that the fade hasn't finished yet:
For example: if(this.greyrectangle._alpha <= 60){ clearInterval(ininterval) }; //so it stops fading after 2 seconds
We lastly need to stop fadeout() being called if a user moves his mouse back on after fading out.
For example: if(!pie){clearInterval(outinterval); pie = true}; //pie is set to false each time fadeout() is called.

What 'outstuff' should have:
The opposite of 'instuff' mostly:
For example: this.greyrectangle._alpha += 2;
this.textbox._alpha -= 5;
if(this.greyrectangle._alpha >= 100){ clearInterval(outinterval) }
pie = false;

What 'clickstuff' should have:
This is the messy bit (at least the functions involved). I'm sure you can do it with masking or something, but I don't get that stuff.
My alternative is to delete the pieces when you pass over them.
After reaching the bottom, the page display is set to visible, and it starts to scroll up.
To prevent the page above the bar to be shown, there should be a large rectangle the same colour as the background with its bottom at the bottom of the bar.
We can simply make a movieclip of this and put it on stage, with _visible as false. When the bar reaches the bottom, set _visible to true and start moving it up. I have it called 'bgoverlay' in my example code.
We need the depth of the bar to be at the top, and the large rectangle in between bars and the page display.
Lastly we need to prevent other clicks and things. We can simply set a variable _root.clicked to true, and have stuff, morestuff, and clickstuff use a conditional statement to check if allowed to move.
For example: on(MouseOver){if(!_root.clicked){ stuff } }; //cilcked should be defined on the stage at the start as false. unless you want to start with displaying one page, in which case you would have an equivalent of clickstuff, and clicked to false.

Okay, firstly we need the movement, we can set an interval to call movedown() every so often.
For example: downinterval = setInterval(movedown, 50); // so movedown() is called 20 times a second.
We also need to make sure that the fade is done, we can either have it fade gradually (have a similar function to fadein() but change the end condition) or just set the values. Since I'm lazy:
this.greyrectangle._alpha = 60; this.textbox._alpha = 100;
We need the depth to be at the top:
Not sure about this piece of code: this.swapDepth(_root.getNextHighestDepth());
Also to stop fadein(), fadeout(), and clickstuff being run multiple times:
_root.clicked = true; //the _root means that it's at the top, leaving out the root would make it specific to the movie clip.

What 'downstuff' should have:
We need to move the rectangle down, obviously:
this._y += 5; //this makes the rectangle cover 100 pixels per second
We need to check if it's passing over another bar, and we need to check if it's at the bottom:
checkover(this._y); //we're passing in the y ordinate of the bar!
if(this._y >= 400){ _root.bgoverlay._visible = true; _root.bgoverlay._y = 0; clearInterval(downinterval); upinterval = setInterval(moveup, 50); } //i'm taking it to stop at 400 pixels down..
//also setting bgoverlay._y to 0 means that it would be 400 pixels high, as it would span from 0 to 400 (where the bar top is.)


What 'overstuff' should have:
This bit is a bit messy too, one way is to store an array of the y ordinates of the bars under the clicked bar, and then test if the y ordinate of the bar is bigger than any of these, and if so, set _visible to false and remove it from the array. If we use this method, clickstuff would need to define this array, and downstuff would redefine it when we start moving upwards - we'd also need to keep a variable of which way we're going. Probably the better way to go about it though.
I'm too lazy to do this, so will do it a different way:
I'm going to assume that the bars are evenly spaced. In this example, I'm going to assume they're spaced with 60 pixels between the top (so 60 = gap + height of one), and the y ordinate of a bar modulo 60 is 40 (so the first bar would be at y = 40, or y = 100.)
I also assume that the bars are named "bar"+num, where num is the amount of times 60 does into the y ordinate - e.g. "bar2" for a y ordinate of 160.
Note this only works if the amount of movement in downstuff divides this number (5 divides 60 easily and evenly!)

if(yp % 60 == 40) { _root["bar"+(yp-40)/60]._visible = false; };

Lastly we need to define 'upstuff':
Basically this is the same as downstuff, except we're moving bgoverlay also.
this._y -= 5; _root.bgoverlay._y -= 5; checkover(this._y); //it tries to set _visible to false for those we've already turned off, but that's fine.
if(this._y <= 50) { _root.bgoverlay._visible = false; clearinterval(upinterval); };


That should be enough for today tongue.gif Make sure you tell me how it goes, or if you don't understand something (basically find where to put that in the code tags at the top, and change all the 'stuff' bits into what's italicized.)

Oh, I think using getNextHighestDepth() wherever it was is a bad idea. It's probably better to have a neat depth pattern (e.g. page is 5, bars are 20-25, bgoverlay is 10, over-the-top bar is 30).

 

 

 


Comment/Reply (w/o sign-up)

sonesay
I had a quick read through all your post but its too detailed and not specific to what I was asking lol. Maybe i'm just too tired and didnt read it correct to understand but I will ask you again to give a high level description on how I would go about creating the first two screents.

Firstly the items on the first screen would be movies that expanded right? is it possible to give them action scripts that displace from each other on hover? I just need some general answers before I can even begin coding since I do not know what limitations are on flash.

I hope you get my point. I will get into the coding part when I need to for now I need a guide on how to start this project.

Thanks again for your time
Sone

Comment/Reply (w/o sign-up)

Nabb
I don't get what you're saying...
I'm having the pages which are displayed as a single movieclip. Each frame is an individual page.

I hacked up the basics of the system and you can see it and get the fla here. (just installed joomla, it's pretty random o_o)
Check how I did it.. (sorry, no comments. forgot about that, I don't usually use them anyways unless I'm removing code)

Comment/Reply (w/o sign-up)

sonesay
thats pretty cool man. are the buttons movie clips that have action scripts applied to them? also they move down differently depending on how far up they are so are they separate movie clips? Sorry if my questions are confusing I'm totally unfamiliar with flash LOL. If you can post the fla for me to look at that would help abit thanks again

Sone

edit: nvm i see the fla lol.

Comment/Reply (w/o sign-up)

dimumurray
Hey Sonesay,
It seems like you're already well on your way with your project (thanks to Nabb I see)smile.gif. I'll add what I can. From the mock-ups in the PDF file, it looks as if you and your partner are aiming for a custom variant on the accordion component. But before I throw in my two cents I need some clarification on a few things. From your initial post I take it you want all the menu items to be in a scroll pane of some sort. But the story boards weren't clear on how to handle a scrollable field along with the rest of the interactions. So I am somewhat at a loss in that regard. In addition there were some other steps missing. For instance what happens to the bars above the selected bar when moving from the 3rd to the 4th frame of the story board. And I'm kinda fuzzy on the last three steps as well. Not such exactly how one leads into another. Forgive me if I appear a bit picky, but its always good to clear up any ambiguity in a design before writing any code.

Comment/Reply (w/o sign-up)

sonesay
Hey thanks for the response. I'm sorry I didn't 'reply back sooner I was brain dead and couldn't read your questions. I been too stressed over assignments due. Anyway back on topic I talked to the designer and he said that the scrolling of items wont be necessary at this stage so there will only be six items.

As button from the 3rd frame moves back up to revel the items content it just starts to mask what ever is above it including any buttons.
I think I have enough to start off with for now thanks to nabb. I just need to look over how he done it and apply that to our version.

Thanks again all any more questions and I will ask again here.

Sone.


Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : flash, action, scripting, hlep, needed

  1. .htaccess
    help needed (0)
  2. The List Component
    in Flash (7)
    Hello! I have a list component in a fla. When I click a button, I add items to the list. (using
    list.addItem ) The problem is that every time I add new items I want to refresh the list; this means
    that I want to delete all items that are in the list and leave only the new ones. Is there anyway to
    do this using only one function? (I know that I can use list.removeItem , but that would mean I have
    to delete every item in the list one by one).....
  3. Mouse Over Alpha Fade
    Flash CS3 (10)
    Hey team, New to the forums and new to Flash. I'm trying to work out what script I need to use
    in order to make a movie clip (a grey square if it matters) change alpha qualities when you roll the
    mouse over it. I also want it to stop and fade back to it's original form when you move the
    mouse off it. I've got it working just using a button symbol but when I take the mouse of it
    just jumps straight back to the original form (ie. no 'fade out') and it also repeats
    itself. I've googled it, and done a search on the forums. I'm sure it's ....
  4. Flash, Php And Facebook Integration
    Plea for good tutorials & resources on the above topic (0)
    Hi all, I'm working on a project. Basically I hope to build a generic web application
    framework that will allow Flash/AS3 applications to be easily integrated into the Facebook platform.
    I am currently surveying a number of technologies and I am trying to figure out what tools will best
    help me achieve that goal. Many of them are open source with some still in early development. Most
    lack extensive documentation so its very difficult to gauge the strengths and weaknesses of a tool
    without investing a good deal of time figuring out how to use them. Is anyone here....
  5. Flash As3 Question
    Alternitives to root (2)
    Hi. Basically, the MovieClip(root) thing is dodgy at the best of times. Besides - it's not
    recommended to use root at all. In fact, it's highly discouraged. I've seen plenty of posts
    about this, but for the life of me, I can't find anything about what else I should use. What
    alternative should I be using to access properties/mc's/etc from the root/parent time lines??
    edit:Cleanup/spelling fixes, etc.....
  6. Flash Problem
    sometimes the buttons will load the wrong link. (9)
    Its weird but sometimes when you hit the forums or roster button on my flash banner it will load:
    www.childrenofconan.trap17.com/index.html instead of what its suppost to. It works fine, but if you
    mess around and click the buttons for a little bit you will notice this happening. This is a problem
    because people visiting the site will sometimes click the button once and be like oh I guess the
    link is broken and never come back, if anyone has a solution to what could be the problem it would
    be awesome. This is one of my first custom flash banners and im just confused what....
  7. Flash - Streaming Flv With Interactible Objects
    Actionscript 3.0 - syncronising swf with flv (3)
    Hi Guys, I am trying to make a flash based web site. The idea is to have a flv video streaming
    which has people moving around and the people need to be clickable objects. I tried tracing the
    video by importing the flv to the flash time line and creating a button that follows a person in
    each frame. I then remove the flv video from the timeline and stream it using actionscript. This
    leads to synchronization issues. Does anyone know if this combination of swf and flv has ever been
    implemented? If so could you please refer me to the source or post a link to an example, i....
  8. Help Needed With Excel Formulas
    (5)
    Hi guys, Here is an example of what my table looks like CODE person           amount
    joe               23 fred              45 fred              32 joe               11
    fred              16 I want to calculate the total amount that fred is responsible for. I'm
    not sure how to use the syntax for excel very well, so i was hoping someone could help. Cheers.....
  9. Flash Coding
    (1)
    I don't know if this is the right section, but does anyone know how to do flash coding and/or
    know a good site to learn it from? I'm trying to make a game like Naruto-Arena . One of my
    friends told me it was made using flash coding and thats why I'm trying to learn it.....
  10. Move The Movie Clip In Flash
    Use the arrow key to move the Movie Clip. (2)
    Movie Clip 1.Create a Movie Clip and draw a Rectangle or your design in the Movie Clip. 2.Come Back
    to Scene 1. 3.Select the Movie Clip and set them instance name = “movie”. 4.Select the first Frame.
    5.Press F9 and Copy Code Below and paste it. CODE setInterval(function () {     if
    (Key.isDown(Key.RIGHT)) {         setDirection(0);         _root.movie._x += 3;     }     if
    (Key.isDown(Key.LEFT)) {         setDirection(1);         _root.movie._x -= 3;     }     if
    (Key.isDown(Key.DOWN)) {         _root.movie._y += 3;     }     if (Key.isDown(Key.UP)) {
            _root....
  11. Contact Form Actionscript
    help needed (3)
    please I need help for an ActionScript to use for the contact form in a flash website I'm using
    Flash MX 2004.......
  12. Need Sugation About Flash
    (4)
    I was informed that in web programing Flash is more afster then Java applets or animated images. So
    that I am thinking about Flash. Now I know that there are many tutorial are available in www. Now
    can any body help me from where I should start. However I have some question on my mind Is it
    difficult to learn? What tools do I need to install? Can you recomended any tutorial? And
    finally my question is why flash is so famous, is it because of it is faster or have there any other
    reason?....
  13. Help Needed About Windows Api And Shell To Build A Shell
    Need help to make a shell for microsoft windows (1)
    Hi I want to buils a new shell for windows with new features and look and security with a new login
    mechanism and logging option incase of network environment(office),like aston shell ,talisam
    desktop,but i dont have proper details aof win32 api and registry changer i need to make to make the
    shell working,please can any one help if someone intrested in working in this project please do tell
    me thanks ....
  14. Flash
    (3)
    Can anyone recommend a book or online guide to flash. i am currently designing a new website, and
    with it, i would like to add flash and all that jazz (kinda like this website ). i want to get an
    good understanding of flash and other things like flash so i can create and design flash based
    websites.....
  15. Flash Vs. Java Applets
    (2)
    As I started to learn Java, I came across a tutorial for making Java applets. As I read on, I found
    some similarities between Java applets and Flash movies. Right when I saw the source code for a
    checkerboard picture made in Java, I said to myself, Flash beats Java applets big time! It also took
    a while to load such a small applet when in Flash it instantly loaded. In my opinion, I think flash
    beats Java applets when it comes to convenience, appearance, load time, animation, and more (except
    AJAX). Here are two articles, first supporting java applets and the other flas....
  16. Flash Tutorial : Realistic Ball Movement
    Flash Tutorial (0)
    QUOTE Hi In this tutorial I am going to show you how to make a ball move around the screen
    realistically and if the ball hits a side of the stage it will bounce. Background colour white.
    550x400 50 fps The first thing you need to do is draw a circle on the stage (50x50) then select it
    and press F8. (You may want to put a line or something through the ball so that you can see it
    rotate). Set it as a MovieClip. Now double click on the circle to edit it, position the ball to be
    in the very center. Now go to the main screen and click on the first frame and open the ....
  17. Flash, Sqlserver And Asp
    (0)
    Hi everyones,



    I going to bang my head because I have been trying to show SqlServer 2000 data in (Flash Mx
    Professional 2004) DataGrid I am working with ASP.NET but I am still unable to....
  18. Swf Cd Help Needed Please
    Need assistance with a next/previous page script (1)
    Question is: I have a web page that displays a flash file that zooms and pans, but the next page
    button doesnt work. 1. Can the next page work and load the next or previous numbered file? 2. Does
    it have to have all pages in one file, then it calls the next frame? I can e-mail you the 3
    pages/files directly, firewall wont let me pload them. Thank you....
  19. Here Is A Really Good Flash Tutorial Site
    (7)
    This site is the best for creating different flash elements and just learning to use macromedia
    flash in general. Click on the link below and you will be taken to step by step tutorials for many
    different flash objects. Flash tutorials ....
  20. Flash Player Simpleviewer Using Flickr And Picassa2
    (0)
    Ok i was told that I can dynamically upload my pictures using flickrviewer. I want to upload them
    to simpleviewer or a flash movie like simpleviewer. Right now what I do is use Picassa2 and make a
    flash movie with my pictures everytime i add new pictures. That is kind of a pain. I wanted to see
    if there was any way to dynamically insert them into the flash movie or if anyone knew how to use
    flickrview. I can't get it to work. here are the links to simpleviewer link and flcikrviewer
    site and flickr site . ....
  21. Playing Flash Movies Without The One-click Activation: Simple Insertion Of Javascript
    (5)
    In the past year or two iternet explorer and other browsers have updated their coding platforms.
    The bad thing is that if you have any flash objects at all within your web page you have to hit the
    space bar or click on the flash object to activate it. Once you activate it, you then can interact
    with the object or the object will then play on the website. I dont like how you have to activate
    the flash player first to interact with it. here is the code to prevent that. Believe me people
    notice how much better the site is after you do this. put under the flash player. ....
  22. Appeal For Flash-related Help [kinda Urgent]
    I could use some help! (0)
    I need a tiny bit of help with some flash files. I have taken up a project in php that I did not
    expect would involve any flash editing, but I am dealing with already existing .swf files that make
    calls to various php files. Now, here's the situation: I don't have the .fla files, only
    .swf. So I need someone who has access to a flash decompiler who can possibly help me out. After
    decompiling the files, I require that all the links/calls to php files, which are made using
    relative paths/addresses, be changed to absolute paths, like change something.php to www.som....
  23. How To Get High Quality Gif Images In Flash
    (11)
    Step 1- Make the Animation Get your animation ready. Make sure not to use any Movie Clips with self
    contained animation for it will be lost in the conversion to an animated gif. Step 2- Publish
    Settings Now that you have your animation you need to go to Publish Settings under File. Now
    uncheck all of the boxes except for gif. This will not effect you if you usually preview your movies
    by the Test Movie feature. If you do use Publish to preview your movies, simply recheck the .swf box
    after this tutorial. Now click the only remaining Gif tab at the top of the box. N....
  24. (regexp Help Needed) Adblock And Wikipedia.org
    weird problem (0)
    THE SITUATION: Whenever I visit wikipedia with adblock, the page comes with no images or
    any css. IE: Whereas when I visit it with adblock disabled, the page displays perfectly.
    THE QUESTION: Can you write the regexp code which will whitelist (allow) all images from
    en.wikipedia.org ?....
  25. How Do I Start Making My Website In Flash
    Can't find tutorials in google :( (11)
    Hey everyone, I began making my website with Firworks, and Dreamweaver. But I really want to know
    how to make a website with Flash. I understand with this program you make 'movies'. I have
    done some tutorials too, and I get that. But what I want to know is, if the content in the different
    pages (like home, contact, links etc.) have to be one movie? Or do you use other programs. Like
    this site below, it's a beautiful site of the Luny Tunes (reggeaton music artistgroup): Luny
    Tunes But is the whole site a 'Movie', or is there some HTML in it as w....
  26. Macromedia Flash
    Who has ever used Macromedia Flash? (9)
    On Christmas, a relative of mine purchased Studio 8 from Macromedia, which is now Adobe. However
    when first running Flash 8, I was very confused...for all people who have ever used Flash, how do
    you make the images move? I tried following the tutorial, and tried "adding a motion tween", however
    I can't get it to work... /sad.gif' border='0' style='vertical-align:middle' alt='sad.gif' />
    Thanks in advance! Stephen....
  27. Print With Flash And Datagrids Without Resizing!
    (4)
    hey hi guys..this is a code i used to print data from a datagrid and it is so useful in ur RIAs hope
    it helps... cheers! CODE mybtn.onPress=function(){ doPrint(mydg, true) } function
    doPrint(datagrid:mx.controls.DataGrid, fitPage:Boolean):Void { if (fitPage == undefined) fitPage =
    true; var pj:PrintJob = new PrintJob(); // position of currently visible rows stored var
    prev_vPosition:Number = datagrid.vPosition; var prev_width:Number = datagrid.width; var
    prev_height:Number = datagrid.height; var prev_vScroll = datagrid.vScrollPolicy; var
    prev_selectedInd....
  28. Which Scripting Language To Start With
    Best question for beginners (8)
    I dont know any scripting languages: Perl, PHP, asp, javascript etc. Which language would be better
    to start with? Any link to start with?(or I should start with google?)Let me know what good books
    are available. Well that is after you guys have recommended the language to start with
    /blink.gif' border='0' style='vertical-align:middle' alt='blink.gif' /> ....
  29. Flash
    (1)
    Does anyone know of a site that can teach you how to use it? Like i would like to read up on it and
    learn how to do it myself. I am just looking for a site that has turtorials and maybe software that
    i can test it out on and see how i do before i purchase anything. If anyone can help with this
    please let me know here, ty very much. -Storm....

    1. Looking for flash, action, scripting, hlep, needed

Searching Video's for flash, action, scripting, hlep, needed
See Also,
advertisement


Flash Action Scripting Help Needed

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com