circlecube

RSS comments
LinkedIn Twitter delicious fb last.fm
14 Jul 2009

Forthcoming Actionscript Image Scroller Tutorial

Author: Evan Mullins | Filed under: tutorial

image-scroller-thumbnail

Here is a preview of a file I’m writing a tutorial for. It’s nothing groundbreaking, but it deals with many normal tasks and will show my process a bit. This tutorial will show how to create a horizontally scrolling image viewer. It will cover xml loading & parsing, loading & resizing external images to fit into a scrollable container, and creating intuitive and responsive scrolling!

Get Adobe Flash player

Let me know what you think, and if there’s anything you want specifically mentioned/explained in it I’ll do my best! Or if you have any ideas of how this could be improved.

Update: The article/tutorial has now been published follow the link to theTutorial to Create a Responsive Image Scroller in ActionScript 3.0

2 Jul 2009

StomperNet FormulaFIVE Launch Web Design

Author: Evan Mullins | Filed under: portfolio

StomperNet relaunched the popular FormaulFIVE and I was responsible for the design of the landing pages. Here are screenshots from the launch, FormulaFIVE was teased with a couple video trailers and even packaged with some bonus videos called the Cash Booster series.
Aviary stomperf5-com Picture 2Aviary stomperf5-com Picture 1Aviary-stomperf5-com-3a
Go to stomperf5.com to view the page.

13 Jun 2009

Stock Flash Site, Introducing ‘BuyStockFlash.com’

Author: Evan Mullins | Filed under: review

Buy Stock Flash


Sell & Buy Flash

Buy or Sell, Start Now -

Stock Flash – Royalty Free Stock Flash effects, Video, Audio

The New Kid on the block… it’s good to see some competition coming to the stock flash world. BuyStockFlash is revving it up. They are positioned to provide a place where flash-ers can upload components, templates, utilities, flv & mp3 players, logos & icons and any other flash elements to sell and earn at least 50% from the proceeds. I haven’t yet uploaded any files, but will once I have some time to do so. They also have a pretty rewarding affiliate program! They let the site speak for itself, displaying a gallery of available files on the homepage. The site just started last fall, is based in Prauge and since they have expanded to become buystocknetwork, including a site for flash, design templates, and sound files!

While the content is still somewhat bare, I’ve seen a few items that are top shelf! I see a lot of potential in this site! Good luck to them and to you, enjoy BuyStockFlash!

26 May 2009

Web Hosting Search Review

Author: Evan Mullins | Filed under: review

I recently stumbled across a site that could easily help with your web hosting needs. They are called Web Hosting Search and as the name indicates, they don’t offer hosting, but offer a database of different hosting companies which make it easy to search and compare rates and services. I found my current host and could have actually gotten a deal for the same plan I currently have, which would have saved me a couple dollars a month! They even have a hosting coupon page which displays specials offers they can get you with a number of recommended hosting providers.

webhostingsearch screenshot

We’re merely a guide that tries to shed light on the web hosting business, to sort out the good deals. We rank web hosting services, write reviews and help customers find the right company and the right plan.

They have company profiles for each hosting company and the opportunity for customers to leave a review and rate the host. I think this is a great feature, as it gives an insider’s view of the company. This is a hard thing to find when you don’t have a recommendation from someone you know. When the time comes for me to look for hosting options, I’ll be sure to start with webhostingsearch.com.

as3dragdrop-slider png A specific use of drag and drop which is a bit more complicated than your average drag & drop needs is a slider. You can use components, but I usually prefer using my own graphics and code, partly because the components tend to bloat the filesize of the swf and partly because that’s just how I am, I like to make it myself. Many projects I’ve worked on require sliders as a form of user input, such as a volume control in my video player, or the inputs for my Voter’s Aide app that let users assign value to issues in the 2008 presidential election. I figured I’d just pull out the code I used with the sliders there, since it was already done. The issue with sliders is we need to restrict the dragging to a certain area, which in itself is a line of code, but I also prefer to allow users to click the actual bar as well for quick selection.

Example

Get Adobe Flash player

Vertical Slider Steps

The vertical slider here goes from 0 – 100. We need to drag the handle but have it restricted to the slider, so users won’t be confused when they click and drag the handle off the slider and break it. We want to click the background bar of the slider and have the handle snap to that place, and we need to be able to see what value the slider holds (0 – 100). I made this code to be pretty reusable, as long as the slider is set up in similar fashion.

  1. Make graphics for slider bg and handle
  2. Put the graphics into a slider mc
  3. Place them each at 0,0 and center their registration points (for easier control and code later)
  4. Assign button mode to handle and bar (for better usability)
  5. Add Mouse Down Event Listener for handle and bar and assign press function
  6. In bar press function set position of handle according to mouse position, and then call the handle press function
  7. In handle press function remove the Mouse Down listeners and add stage mouse event listeners for both mouse Up and Move (Stage listeners emulate onReleaseOutside (from as2) and also provide more accurate results)
  8. Define dragging area as a rectangle(x, y, width, height), if you’ve do the set up earlier it should be close to Rectangle(0,0,0,slider.bar.height);
  9. Begin dragging handle and apply the drag area limiting rectangle
  10. Mouse Move function find value (should simply be the handle’s y position) and updateAfterEvent for smooth animation
  11. Mouse Release function remove stage listeners, re-add the listeners to the slider and stop dragging

Actionscript (as3)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Vertical Slider
sliderVertical.handle.buttonMode = true;
sliderVertical.bar.buttonMode = true;
sliderVertical.handle.addEventListener(MouseEvent.MOUSE_DOWN, verticalHandlePress);
sliderVertical.bar.addEventListener(MouseEvent.MOUSE_DOWN, verticalBarPress);

function verticalBarPress(e:MouseEvent):void{
    sliderVertical.handle.y = sliderVertical.mouseY;
    verticalHandlePress(e);
}
function verticalHandlePress(e:MouseEvent):void {
    sliderVertical.handle.removeEventListener(MouseEvent.MOUSE_DOWN, verticalHandlePress);
    sliderVertical.bar.removeEventListener(MouseEvent.MOUSE_DOWN, verticalBarPress);
    stage.addEventListener(MouseEvent.MOUSE_UP, verticalHandleRelease);
    stage.addEventListener(MouseEvent.MOUSE_MOVE, verticalHandleDrag);
    //limit dragging area
    var verticalDragArea:Rectangle = new Rectangle(0, 0, 0, -sliderVertical.bar.height+1);
    sliderVertical.handle.startDrag(false, verticalDragArea);
}
function verticalHandleRelease(e:MouseEvent):void{
    stage.removeEventListener(MouseEvent.MOUSE_UP, verticalHandleRelease);
    stage.removeEventListener(MouseEvent.MOUSE_MOVE, verticalHandleDrag);
    sliderVertical.bar.addEventListener(MouseEvent.MOUSE_DOWN, verticalBarPress);
    sliderVertical.handle.addEventListener(MouseEvent.MOUSE_DOWN, verticalHandlePress);
   
    sliderVertical.handle.stopDrag();
    updateVNumber();
}
function verticalHandleDrag(e:MouseEvent):void{
    e.updateAfterEvent();
    updateVNumber();
}
function updateVNumber():void{
    sliderVertical.sliderValue = sliderVertical.stat.htmlText = Math.abs(sliderVertical.handle.y);
    sliderVertical.stat.y = sliderVertical.handle.y - sliderVertical.handle.height/2;
}

Horizontal Slider Steps

Pretty much the same as the vertical slider, but adjust heights and y positions to widths and x positions. Note in this example I have a range of (-100 to 100) and to accomplish the bar I just reused the same on flipping it around, so here we have the handle, the barLeft and the barRight. I use both of these combined to calculate the limiting rectangle area.

Actionscript (as3)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Horizontal Slider
sliderHorizontal.handle.buttonMode = true;
sliderHorizontal.barLeft.buttonMode = true;
sliderHorizontal.barRight.buttonMode = true;
sliderHorizontal.handle.addEventListener(MouseEvent.MOUSE_DOWN, horizontalHandlePress);
sliderHorizontal.barLeft.addEventListener(MouseEvent.MOUSE_DOWN, horizontalBarPress);
sliderHorizontal.barRight.addEventListener(MouseEvent.MOUSE_DOWN, horizontalBarPress);

function horizontalBarPress(e:MouseEvent):void{
    sliderHorizontal.handle.x = sliderHorizontal.mouseX;
    horizontalHandlePress(e);
}
function horizontalHandlePress(e:MouseEvent):void {
    sliderHorizontal.handle.removeEventListener(MouseEvent.MOUSE_DOWN, horizontalHandlePress);
    sliderHorizontal.barLeft.removeEventListener(MouseEvent.MOUSE_DOWN, horizontalBarPress);
    sliderHorizontal.barRight.removeEventListener(MouseEvent.MOUSE_DOWN, horizontalBarPress);
    stage.addEventListener(MouseEvent.MOUSE_UP, horizontalHandleRelease);
    stage.addEventListener(MouseEvent.MOUSE_MOVE, horizontalHandleDrag);
    //limit dragging area
    var dragArea:Rectangle = new Rectangle(-sliderHorizontal.barLeft.width+1, 0, sliderHorizontal.barLeft.width+sliderHorizontal.barRight.width-2, 0);
    sliderHorizontal.handle.startDrag(false, dragArea);
}
function horizontalHandleRelease(e:MouseEvent):void{
    stage.removeEventListener(MouseEvent.MOUSE_UP, horizontalHandleRelease);
    stage.removeEventListener(MouseEvent.MOUSE_MOVE, horizontalHandleDrag);
    sliderHorizontal.handle.addEventListener(MouseEvent.MOUSE_DOWN, horizontalHandlePress);
    sliderHorizontal.barLeft.addEventListener(MouseEvent.MOUSE_DOWN, horizontalBarPress);
    sliderHorizontal.barRight.addEventListener(MouseEvent.MOUSE_DOWN, horizontalBarPress);
   
    sliderHorizontal.handle.stopDrag();
    updateHNumber();
}
function horizontalHandleDrag(e:MouseEvent):void{
    e.updateAfterEvent();
    updateHNumber();
}
function updateHNumber():void{
    sliderHorizontal.sliderValue = sliderHorizontal.stat.htmlText = sliderHorizontal.handle.x;
    sliderHorizontal.stat.x = sliderHorizontal.handle.x - sliderHorizontal.handle.width;
}

Source

source as3dragdrop-sliders.fla file