Easing function
Hi!
Is it possible to use custom easing function (or at least one of the functions defined in mx.effects.easing package) with spark effect?
Thanks
No, the new effects require the new easing classes in spark.effects.easing.
I do have a utility class somewhere that wraps the old functions in a new class, allowing you to bridge them. I plan on posting that to my blog sometime soon, if that would help.
Are there particular easing functions that you're missing in the new world? I'm planning on offering more of them eventually, but it would be helpful to know which ones you find important.
Chet.
Similar Messages
-
I am using easing function generated object to tween my movie
clips. But not getting what the wrong I am doing:
Please helpHello
I have just heard back from our developers. The issue has been reproduced and entered into their bug reporting system with ID: 117065. The fix will be included in one of the future versions. There is no direct workaround though. If you have an educational version of Multisim, you can use the generator coming with NI-ELVISmx drivers - this one works fine. Please let me know if there is anything else I can help you with.
Best regards,
Maciej Antonik
National Instruments Poland -
Integration with a Reporting Engine Web Service
I want to use a separate reporting engine for my reports. That is, use APEX to perform the filtering and parameter settings and preview the result in APEX. But the final formatted output will use a more complex layout. Sorry, cannot use BI Publisher or PL/PDF (license issues). Other FOP solution isn't sufficient as well because I'm planning to centralized our reports.
I already tried using Jasper Reports (also BIRT and Pentaho,they seem identical to me) Web Service but with no luck. I don't want to invest too much time in learning these tools since I don't know if it will ever work with APEX.
We do have SQL Server 2005 but I'm currently learning its reporting services. I'm a MS Access developer and already have enough of it. Anybody got a suggestion?
ThanksHi Mertz,
Well you have to bear in mind that Oracle have made it incredibly simple to integrate APEX with BIP to produce some visually stunning reports that contain data that can be pretty complex.
However...obviously you need to stump up the money for BIP to get that level of ease/functionality.
So, what you're really asking is: is there a way I can produce output just as complex as BIP without the price tag of BIP?
If that's the question the answer is definitely yes, you can use FOP. Anything you can do using BIP (and the BIP Desktop) tool you can do with FOP (or pretty much everything, I haven't found any real big exceptions to the rule).
However, the 'price' you pay with FOP is that it's another layer that you need to learn about (unlike diving into the BIP desktop plugins to design your form). However you do get complete control over the layout of your exports.
John.
http://jes.blogs.shellprompt.net
http://apex-evangelists.com -
Trouble with parallel add and remove effect in TileList
We have a TileList of images. As the user drags a new image along the list (deciding where to drop it) a blank frame drops in to show them where it will be inserted when they drop it. Therefore, I have to add and remove simultaneously, while still dragging. For example if they are at index zero, a blank frame is in index zero. As they move to 1, the blank frame appears to move from index zero, to index one, as the image that was at index one appears to move to index zero. But what I'm really doing is just removing and then adding the blank frame.
I think the following code should accomplish this. And it works, most of the time. Every so often, there is a delay where is does the REMOVE, and then waits until the Back.easeOut tween is complete, and then does the ADD. It is intermittent. Any ideas, or is there a better way to do it? Thanks
MXML code:
<mx:Sequence id="myEffect">
<mx:Parallel>
<mx:Move
duration="600"
easingFunction="{Back.easeOut}"
/>
<mx:RemoveItemAction id="dcmRemoveItemActionTag"
/>
<mx:AddItemAction id="dcmAddItemActionTag"
/>
</mx:Parallel>
</mx:Sequence>
actionscript code:
_sharedMedia.removeItemAt(_sharedMedia.getItemIndex(_dropPlaceHolderimage));
_sharedMedia.addItemAt(_dropPlaceHolderimage,dropIndex);hi,
You could do this a couple of ways, you could have a slight delay set on the remove effect so that it doesn't interfere with the ease function.
or
You could add the item instead of an empty frame, on the dragdrop event you don't need to do anything if you get a dragexit triggered then you simply remove the item completely.
David -
Hey guys, I'm trying to make a section of my web page scroll horizontally. I have found several working examples of this but they all make the entire <body> tag scrollable. I want just the blue outlined section in the following image to scroll and for everything else, including the background, to stay fixed to the page.
You can visit the live site at http://www.kylelord.com. I will also include the code to the body section here to make it easier but you can view the source on the live site if you'd rather.
<body>
<div id="container">
<div id="header"></div>
<div id="content">
<div id="about">
<div id="aboutHead"></div>
<div id="aboutBody">
<p>Graphic designer in the Philadelphia and New York area.</p>
<p>Driven and hard-working person with an excellent sense of design.</p>
<p>Specialties include publication, advertising, and web.</p>
</div>
<div id="contact">
<p><a href="mailto:[email protected]"><img src="images/mail-02.png" /> [email protected]</a></p>
<p> <img src="images/phone-02.png" /> <span class="mobile"><a href="tel:18459268873">845.926.8873</a></span></p></div>
</div><!--end about section-->
<div id="featured">
<div id="featuredHead"></div>
<div id="row1">
<!--PS3 LightBox-->
<span class="imagePlaceholder"><a href="images/portfolio/fullsize/ps3_1.png" rel="lightbox[ps3]" title="Playstation 3 Ad Campaign"><img src="images/portfolio/thumbs/ps3_thumb.png" class="imageCenter" /></a>
<a href="images/portfolio/fullsize/ps3_2.png" rel="lightbox[ps3]" title="Playstation 3 Ad Campaign"></a>
<a href="images/portfolio/fullsize/ps3_3.png" rel="lightbox[ps3]" title="Playstation 3 Ad Campaign"></a>
</span>
<!--The Modern LightBox-->
<span class="imagePlaceholder"><a href="images/portfolio/fullsize/mod1.png" rel="lightbox[modern]" title="The Modern Restaurant Identity and Menu | Dinner Menu"><img src="images/portfolio/thumbs/modern_thumb-02.png" class="imageCenter" /></a>
<a href="images/portfolio/fullsize/mod2.png" rel="lightbox[modern]" title="The Modern Restaurant Identity and Menu | Dinner Menu"></a>
<a href="images/portfolio/fullsize/mod3.png" rel="lightbox[modern]" title="The Modern Restaurant Identity and Menu | Dinner Menu"></a>
<a href="images/portfolio/fullsize/mod4.png" rel="lightbox[modern]" title="The Modern Restaurant Identity and Menu | Drink Menu"></a>
<a href="images/portfolio/fullsize/mod5.png" rel="lightbox[modern]" title="The Modern Restaurant Identity and Menu | Drink Menu"></a>
<a href="images/portfolio/fullsize/mod6.png" rel="lightbox[modern]" title="The Modern Restaurant Identity and Menu | Dessert Menu"></a>
<a href="images/portfolio/fullsize/mod7.png" rel="lightbox[modern]" title="The Modern Restaurant Identity and Menu | Identity"></a>
</span>
</div>
<div id="row2">
<!--Ludwig and Son's LightBox-->
<span class="imagePlaceholder"><a href="images/portfolio/fullsize/lud1.png" rel="lightbox[lud]" title="Ludwig & Son's Corporate Identity"><img src="images/portfolio/thumbs/lud_thumb-02.png" class="imageCenter" /></a>
<a href="images/portfolio/fullsize/lud2.png" rel="lightbox[lud]" title="Ludwig & Son's Corporate Identity"></a>
</span>
<!--The Audition LightBox-->
<span class="imagePlaceholder"><a href="images/portfolio/fullsize/ed1.png" rel="lightbox[ed]" title="Alternative Press Editorial"><img src="images/portfolio/thumbs/ap_thumb-02.png" class="imageCenter" /></a>
<a href="images/portfolio/fullsize/ed2.png" rel="lightbox[ed]" title="Alternative Press Editorial"></a>
<a href="images/portfolio/fullsize/ed3.png" rel="lightbox[ed]" title="Alternative Press Editorial"></a>
<a href="images/portfolio/fullsize/ed4.png" rel="lightbox[ed]" title="Alternative Press Editorial"></a>
</span>
</div>
<div id="row3">
<!--Kindle LightBox-->
<span class="imagePlaceholder"><a href="images/portfolio/fullsize/ad1.png" rel="lightbox[kindle]" title="Kindle Advertising Campaign"><img src="images/portfolio/thumbs/ad_thumb-02.png" class="imageCenter" /></a>
<a href="images/portfolio/fullsize/ad2.png" rel="lightbox[kindle]" title="Kindle Advertising Campaign"></a>
<a href="images/portfolio/fullsize/ad3.png" rel="lightbox[kindle]" title="Kindle Advertising Campaign"></a>
<a href="images/portfolio/fullsize/ad4.png" rel="lightbox[kindle]" title="Kindle Advertising Campaign"></a>
</span>
<!--Calendar Lightbox-->
<span class="imagePlaceholder"><a href="images/portfolio/fullsize/cal1.png" rel="lightbox[calendar]" title="Circular Typographic Calendar"><img src="images/portfolio/thumbs/cal_thumb-02.png" class="imageCenter" /></a>
<a href="images/portfolio/fullsize/cal2.png" rel="lightbox[calendar]" title="Circular Typographic Calendar"></a>
<a href="images/portfolio/fullsize/cal3.png" rel="lightbox[calendar]" title="Circular Typographic Calendar"></a>
<a href="images/portfolio/fullsize/cal4.png" rel="lightbox[calendar]" title="Circular Typographic Calendar"></a>
<a href="images/portfolio/fullsize/cal5.png" rel="lightbox[calendar]" title="Circular Typographic Calendar"></a>
<a href="images/portfolio/fullsize/cal6.png" rel="lightbox[calendar]" title="Circular Typographic Calendar"></a>
<a href="images/portfolio/fullsize/cal7.png" rel="lightbox[calendar]" title="Circular Typographic Calendar"></a>
<a href="images/portfolio/fullsize/cal8.png" rel="lightbox[calendar]" title="Circular Typographic Calendar"></a>
<a href="images/portfolio/fullsize/cal9.png" rel="lightbox[calendar]" title="Circular Typographic Calendar"></a>
<a href="images/portfolio/fullsize/cal10.png" rel="lightbox[calendar]" title="Circular Typographic Calendar"></a>
<a href="images/portfolio/fullsize/cal11.png" rel="lightbox[calendar]" title="Circular Typographic Calendar"></a>
<a href="images/portfolio/fullsize/cal12.png" rel="lightbox[calendar]" title="Circular Typographic Calendar"></a>
</span>
</div>
</div><!--end featured section-->
<div id="caseStudy">
<div id="type">
<h1><a href="marfan.html" title="National Marfan Foundation">Click</a></h1>
<h2>this guy to hear his story</h2>
</div>
<div id="stick">
<a href="marfan.html" title="National Marfan Foundation"><img src="images/stick.png" onmouseover="this.src='images/stick-over.png'" onmouseout="this.src='images/stick.png'" /></a>
</div>
</div>
</div><!--end content-->
<div id="footer">
<div id="downloads">
<h1>Downloads</h1>
<p><a href="downloads/KyleLord_portfolio.pdf">Portfolio</a></p>
<p><a href="downloads/KyleLord_resume.pdf">Resume</a></p>
</div>
<div id="contactlinks">
<h1>Contact</h1>
<p><a href="mailto:[email protected]">[email protected]</a></p>
<p><span class="mobile"><a href="tel:18459268873">845.926.8873</a></span></p>
</div>
<div id="copyright">
<a href="http://www.facebook.com/eyeamthekiller0" target="_blank"><img src="images/facebook.png"/></a>
<a href="https://twitter.com/#!/Kyle_Design" target="_blank"><img src="images/twitter.png" /></a>
<a href="http://www.linkedin.com/pub/kyle-lord/32/a94/125" target="_blank"><img src="images/linkedin.png" /></a>
<p>© 2012 Kyle Lord.</p>
</div>
</div>
<div id="underFooter"></div>
</div><!--end container-->
</body>
After researching horizontal scrolling on some sites it seems that I will have to use JQuery to add a "smooth scrolling" effect the page. I also plan to add a link that will lead to an anchor that will exist outside of the visible area (to the right), that is when I plan for the scrolling effect to take place. I want it to animate by scrolling from right to left all the way to the anchor that is linked to. Here are some links to sites I have read up about it on. They also demonstrate the type of effect that I want.
http://www.sitepoint.com/side-scrolling-site-layout-with-css-and-jquery/
http://tympanus.net/codrops/2010/06/02/smooth-vertical-or-horizontal-page-scrolling-with-j query/
http://css-tricks.com/how-to-create-a-horizontally-scrolling-site/
It may be an easy fix but I don't have much experience with JavaScript or JQuery. Any help or ideas would be appreciated. I would not object to alternate ideas.
-Kyle
Graphic Designer
[email protected]Place all you want to scroll inside of a movieclip, and give it a instace of dragMe, then paste this code into your timeline
var ease:int = 6;
var targY:int = dragMe.x;
var drag:Boolean = false;
var ptY:Number = 0;
dragMe.addEventListener(Event.ENTER_FRAME, dragHandler, false, 0, true);
dragMe.addEventListener(MouseEvent.MOUSE_DOWN, downHandler, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, upHandler, false, 0, true);
function dragHandler(e:Event):void
if (drag)
targY = mouseX + ptY;
e.target.x += (targY - e.currentTarget.x) / ease;
function upHandler(event:MouseEvent):void
drag = false;
function downHandler(e:MouseEvent):void
ptY = e.currentTarget.x - mouseX;
drag = true; -
Adding Scrollbar and buttons to Dynamic Text
Hello,
I am trying to connect dynamic text to scrollbar and buttons. I did tutorial and Lynda.com and practically pasted the code in with my file names and for some reason it does not work. It says I have a "Access of Undefined Property mask_mc" Did I need to create a variable for this? I didn't in the tutorial.
Right now I have the dynamic text loading successfuly in 2 different places and I wantd to add the scrollbar. I put the variables on frame 1 code and then I put the actually load code on the frame where it is needed.
Any suggestions?
Thanks! Sandra
HERE IS CODE FOR FRAME 1:
var textLoader:URLLoader = new URLLoader();
var textReq:URLRequest;
var scrollPercent:Number = 0;
var minScroll:Number;
var maxScroll:Number;
var targetScroll:Number = philText_mc.y;
var easing:Number = 5;
var scrollAmt:Number = 15;
var scrollDirection:Number = 0;
HERE IS CODE FOR FRAME WHERE TEXT LOADS:
textReq = new URLRequest("text_philosophy.txt");
function philosophyTextLoaded(event:Event):void {
philText_mc.philosophy_txt.text = textLoader.data;
minScroll = philText_mc.y;
maxScroll = minScroll - philText_mc.height + mask_mc.height;
function dragScroller(event:MouseEvent):void
var dragX:Number = line_mc.x - scroller_mc.width/2 + 1;
var dragY:Number = line_mc.y;
var dragW:Number = 0;
var dragH:Number = line_mc.height - scroller_mc.height;
scroller_mc.startDrag(false, new Rectangle(dragX,dragY,dragW,dragH));
stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
stage.addEventListener(Event.ENTER_FRAME, setScrollPercent);
stage.removeEventListener(Event.ENTER_FRAME, scrollText);
function stopDragging(event:MouseEvent):void
scroller_mc.stopDrag();
function setScrollPercent(event:Event):void
scrollPercent = (scroller_mc.y - line_mc.y) / (line_mc.height - scroller_mc.height);
if(scrollPercent < 0)
scrollPercent = 0;
else if(scrollPercent > 1)
scrollPercent = 1;
targetScroll = (scrollPercent * (maxScroll - minScroll)) + minScroll;
philText_mc.y -= (philText_mc.y - targetScroll) / easing;
function scrollUp(event:MouseEvent):void
setDirection(scrollAmt);
function scrollDown(event:MouseEvent):void
setDirection(-scrollAmt);
function setDirection(dir:Number):void
scrollDirection = dir;
stage.addEventListener(Event.ENTER_FRAME, scrollText);
stage.addEventListener(MouseEvent.MOUSE_UP, stopScrolling);
stage.removeEventListener(Event.ENTER_FRAME, setScrollPercent);
function scrollText(event:Event):void
targetScroll += scrollDirection;
philText_mc.y -= (philText_mc.y - targetScroll) / easing;
if(philText_mc.y > minScroll)
philText_mc.y = minScroll;
targetScroll = minScroll;
else if(philText_mc.y < maxScroll)
philText_mc.y = maxScroll;
targetScroll = maxScroll;
scrollPercent = (philText_mc.y - minScroll) / (maxScroll - minScroll);
scroller_mc.y = (scrollPercent * (line_mc.height - scroller_mc.height)) + line_mc.y;
function stopScrolling(event:MouseEvent):void
scrollDirection = 0;
textLoader.load(textReq);
scroller_mc.buttonMode = true;
philText_mc.external_txt.autoSize = TextFieldAutoSize.LEFT;
scroller_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragScroller);
textLoader.addEventListener(Event.COMPLETE, philosophyTextLoaded);
up_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollUp);
down_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollDown);Hello again,
Maybe I am asking this question wrong. Instead of making you try and figure out what's going on in my file what I really need to know is how you would take this code I am attaching and make it happen on another frame besides frame 1 and it doesn't appear on frame 1. I think this may help me understand a little better.
Also another way I was thinking to get around this would be to pull in an external swf into the spot where I want this text to go because I can make the scrollbars and external text work when it is the only thing going on in the movie. Would this be a bad way to set this up? and also SInce it is an external movie would I have maintimeline issues with mouse/scroller control?
thanks! sandra
Here is working code:
var textLoader:URLLoader = new URLLoader();
var textFile:URLRequest = new URLRequest("text/external.txt");
var scrollPercent:Number = 0;
var minScroll:Number;
var maxScroll:Number;
var targetScroll:Number = text_mc.y;
var easing:Number = 5;
var scrollAmt:Number = 15;
var scrollDirection:Number = 0;
function textLoaded(event:Event):void
text_mc.external_txt.text = textLoader.data;
minScroll = text_mc.y;
maxScroll = minScroll - text_mc.height + mask_mc.height;
function dragScroller(event:MouseEvent):void
var dragX:Number = line_mc.x - scroller_mc.width/2 + 1;
var dragY:Number = line_mc.y;
var dragW:Number = 0;
var dragH:Number = line_mc.height - scroller_mc.height;
scroller_mc.startDrag(false, new Rectangle(dragX,dragY,dragW,dragH));
stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
stage.addEventListener(Event.ENTER_FRAME, setScrollPercent);
stage.removeEventListener(Event.ENTER_FRAME, scrollText);
function stopDragging(event:MouseEvent):void
scroller_mc.stopDrag();
function setScrollPercent(event:Event):void
scrollPercent = (scroller_mc.y - line_mc.y) / (line_mc.height - scroller_mc.height);
if(scrollPercent < 0)
scrollPercent = 0;
else if(scrollPercent > 1)
scrollPercent = 1;
targetScroll = (scrollPercent * (maxScroll - minScroll)) + minScroll;
text_mc.y -= (text_mc.y - targetScroll) / easing;
function scrollUp(event:MouseEvent):void
setDirection(scrollAmt);
function scrollDown(event:MouseEvent):void
setDirection(-scrollAmt);
function setDirection(dir:Number):void
scrollDirection = dir;
stage.addEventListener(Event.ENTER_FRAME, scrollText);
stage.addEventListener(MouseEvent.MOUSE_UP, stopScrolling);
stage.removeEventListener(Event.ENTER_FRAME, setScrollPercent);
function scrollText(event:Event):void
targetScroll += scrollDirection;
text_mc.y -= (text_mc.y - targetScroll) / easing;
if(text_mc.y > minScroll)
text_mc.y = minScroll;
targetScroll = minScroll;
else if(text_mc.y < maxScroll)
text_mc.y = maxScroll;
targetScroll = maxScroll;
scrollPercent = (text_mc.y - minScroll) / (maxScroll - minScroll);
scroller_mc.y = (scrollPercent * (line_mc.height - scroller_mc.height)) + line_mc.y;
function stopScrolling(event:MouseEvent):void
scrollDirection = 0;
textLoader.load(textFile);
scroller_mc.buttonMode = true;
text_mc.external_txt.autoSize = TextFieldAutoSize.LEFT;
scroller_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragScroller);
textLoader.addEventListener(Event.COMPLETE, textLoaded);
up_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollUp);
down_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollDown); -
I'm trying to help a friend with the Flash Banner Rotator
She needs to make the image clickable and pop up the scroll text box item exactly like when you rollOver the title and the scroll text box pops up.
She wants the image to trigger the text box to open and close onRelease and onRollOut from the image.
Here's the swf live:
http://bgehome.com/index3.php
Any help would be great
This AS opens the Text Box
textMc.scrolltxt.bg.onRollOver = function(){ // pop up scrolltxt
mainContent["tex" + newPos]._y = thumbHeight - textMc.scrolltxt.bg._height;
isReading = true;
textMc.scrolltxt.bg.onRollOut = textMc.scrolltxt.bg.onReleaseOutside = function(){ // pop down scrolltxt
if(!mainContent["tex" + newPos].scrolltxt.bg.hitTest(_root._xmouse, _root._ymouse, true)){
mainContent["tex" + newPos]._y = thumbHeight - textMc.imtext._height;
isReading = false;
Full AS
thumb.useHandCursor=false;
// Thumb/ Banner Rotator //
///Initialisation //
var bgmask:MovieClip = bckgrnd.duplicateMovieClip("bgmask"); // Create a mask to place on top of mainContent, which contains the images
var contentWidth:Number = bgmask._width;
bgmask._width = contentWidth;
var XMLContent = new XML(); // Create a new XML object
XMLContent.ignoreWhite = true;
XMLContent.load("Banner.xml"); // Load the XML content from Banner.xml (which is the name of the xml file) in XMLContent variable
//XMLContent.load("Thumbnail.xml");
var cssStyle = new TextField.StyleSheet(); // Create a new StyleSheet object
// Create Containers
var mainContent:MovieClip = this.createEmptyMovieClip("mainContent",this.getNextHighestDepth()); // Contains thumbs
leftBtn.swapDepths(mainContent); // Make sure leftBtn ...
rightBtn.swapDepths(leftBtn.getDepth + 1); // and rightBtn is on top of the mainContent
var pieMc:MovieClip = this.createEmptyMovieClip("pie", this.getNextHighestDepth()); // Create movieClip which contains the pieLoader
var format = new TextFormat(); // Make a new TextFormat
format.font = "arial"; // with font PF Ronda Seven, if you want to change the font, do it here
format.size = 18; // Font size, for pixel fonts use 8
var mclListener:Object = new Object(); // Make event listener object
var clipLoader = new MovieClipLoader(); // Make a MovieCLipLoader to load the images
clipLoader.addListener(mclListener); // The event listener is added to the MovieClipLoader object
var iniNum:Number = 0; // initional relative number for thumb/banner positioning
var thumbHeight:Number; // see xml document
var thumbWidth:Number; // see xml document
var thumbSpace:Number; // see xml document
var contentPos_Y:Number; // see xml document
var thumbDir:String; // see xml document
var dispThumbNumber:Number; // see xml document
var linkDestiny:String; // see xml document
var shiftTime:Number; // see xml document
var fadeInTime:Number; // see xml document
var easeSpeed:Number; // see xml document
var imagesTotal:Number; // amount of thumbs
var dwLoader:Number = 0; // pie segment angle
var arcVal:Number = 0; // total pie angle
var isReading:Boolean = false; // boolean: set true when reading. When true the pieLoader will stop
var prevXPosition:Number = 0; // previous absolute x position
var nextXPosition:Number = 0; // next absolute x position
var images; // image array
// XML, CSS Loading //
cssStyle.load("ThumbBannerRotator.css");
XMLContent.onLoad = function() { // Couple xml parameters with program variables
iniNum = 0;
nextXPosition = 0;
prevXPosition = 0;
dwLoader = 0;
arcVal = 0;
// images = array with images and titles and webUrls
images = XMLContent.firstChild.childNodes[0].childNodes;
imagesTotal = images.length;
// Other parameters
thumbHeight = XMLContent.firstChild.attributes.thumbHeight;
thumbWidth = XMLContent.firstChild.attributes.thumbWidth;
startPos = XMLContent.firstChild.attributes.startPos;
easeSpeed = XMLContent.firstChild.attributes.easeSpeed;
linkDestiny = XMLContent.firstChild.attributes.linkDestiny;
thumbDir = XMLContent.firstChild.attributes.thumbDir;
dispThumbNumber = XMLContent.firstChild.attributes.dispThumbNumber;
shiftTime = XMLContent.firstChild.attributes.shiftTime;
fadeInTime = XMLContent.firstChild.attributes.fadeInTime;
// Calculate the other program variables
contentPos_Y = (bckgrnd._height - Number(thumbHeight))/2
thumbSpace = (contentWidth - dispThumbNumber*thumbWidth)/(Number(dispThumbNumber) +1);
dwLoader = 100 * 3.6 / (Number(shiftTime) * 24);
mainContent._y = contentPos_Y; // Position form top
bgmask._height = thumbHeight;
bgmask._y = contentPos_Y;
mainContent.setMask(bgmask);
// Load the first images
for(var i = 0; i < dispThumbNumber ; i++){
loadImage(i,0,"load");
loadText(i,0,"load");
function shiftPic(direction:String){
if (isReading == false){
callPic(direction);
function callPic(direction:String) { // Call images, captions and titles and add them to containers: mainContent
if(direction == "left"){
var newPos:Number = (iniNum -1) % imagesTotal; // Calculate the relative position off the new image, this number corresponds with the index number from the image-array
var remPos:Number = (iniNum+( Number(dispThumbNumber) - 1)) % imagesTotal; // Calculate the relative position off the image that needs to be removed
var prevPos:Number = iniNum % imagesTotal; // Calculate the relative position off the images before the new image
nextXPosition = prevXPosition + Number(thumbSpace) + Number(thumbWidth); // Calculate the absolute x position = previous position + thumbSpace and thumbWidth, used in ease function
prevXPosition = nextXPosition; // Update prevPosition
iniNum = iniNum - 1; // Substract the iniNumber
if(direction == "right"){
var remPos:Number = iniNum % imagesTotal; // Calculate the relative position off the new image, this number corresponds with the index number from the image-array
var newPos:Number = (iniNum+ Number(dispThumbNumber)) % imagesTotal; // Calculate the relative position off the image that needs to be removed
var prevPos:Number = (iniNum+(Number(dispThumbNumber) - 1)) % imagesTotal; // Calculate the relative position off the images before the new image
nextXPosition = prevXPosition - Number(thumbSpace) - Number(thumbWidth); // Calculate the absolute x position = previous position + thumbSpace and thumbWidth
prevXPosition = nextXPosition; // Update prevPosition
iniNum = iniNum + 1;
if (newPos < 0){ //If newPos is negative, make it positive
newPos = imagesTotal + newPos;
if (remPos < 0){ //If remPos is negative, make it positive
remPos = imagesTotal + remPos;
if (prevPos < 0){ //If prevPos is negative, make it positive
prevPos = imagesTotal + prevPos;
loadImage(newPos, prevPos, direction); // Load images and image titles
loadText(newPos, prevPos , direction); // Load titles and caption
mainContent[remPos].removeMovieClip(); // remove the image with name "remPos"
mainContent["tex" + remPos].removeMovieClip(); // remove the text with name tex"remPos"
arcVal = 0; // reset the pieLoader
function loadImage(newPos:Number, prevPos:Number, direction:String){
thumbURL = images[newPos].attributes.thumbPath; // Get thumbUrl from images-array
thumbMc = mainContent.createEmptyMovieClip(""+newPos, mainContent.getNextHighestDepth()); // Create new thumbMc movieClip variable
thumbMc._alpha = 0; // Alpha = zero for fade in effect
if (direction == "left"){
thumbMc._x = mainContent[prevPos]._x - Number(thumbWidth) - Number(thumbSpace); // positioning of thumbMc
if (direction == "right"){
thumbMc._x = mainContent[prevPos]._x + Number(thumbWidth) + Number(thumbSpace); // positioning of thumbMc
if(direction == "load"){
thumbMc._x = Number(thumbWidth*newPos) + Number(thumbSpace*(newPos+1)) ; // positioning of thumbMc
addLoader(thumbMc);
clipLoader.loadClip(thumbDir+thumbURL, thumbMc); // Load the images in the thumbMc
function loadText(newPos:Number, prevPos:Number, direction:String){
thumbTitle = images[newPos].attributes.title; // Get title from images-array
thumbDesc = images[newPos].attributes.description; // Get caption description from images-array
textMc = mainContent.createEmptyMovieClip("tex"+newPos, mainContent.getNextHighestDepth()); // Create new titleMc moveClip variable
if (direction == "left"){
textMc._x = mainContent[prevPos]._x - Number(thumbWidth) - Number(thumbSpace); // positioning of textMc
if (direction == "right"){
textMc._x = mainContent[prevPos]._x + Number(thumbWidth) + Number(thumbSpace); // positioning of textMc
if(direction == "load"){
textMc._x = Number(thumbWidth*newPos) + Number(thumbSpace*(newPos+1)) ; // positioning of textMc
textMc.attachMovie("scrollText" , "scrolltxt", textMc.getNextHighestDepth());
textMc.scrolltxt.bg._width = Number(thumbWidth); // set background width
textMc.scrolltxt.main.content.styleSheet = cssStyle; // set css style
textMc.scrolltxt.main.content._width = Number(thumbWidth) - 30; // set scrolltext components width
textMc.scrolltxt.maskMc._width = Number(thumbWidth) - 10; // set scrolltext components width
textMc.scrolltxt.dragger._x = textMc.scrolltxt.bar._x = textMc.scrolltxt.upBtn._x = textMc.scrolltxt.downBtn._x = textMc.scrolltxt.stripe._x = Number(thumbWidth) - 10; // positioning of scrolltext components
textMc.scrolltxt.main.content.text = thumbDesc; // set text
textMc.scrolltxt.main.content.embedFonts = true;
textMc.scrolltxt.main.content.selectable = false;
textMc.scrolltxt.main.content.setTextFormat(format); // set text format
textMc.scrolltxt.main.content._height = textMc.scrolltxt.main.content.textHeight + 5; // calculate height of text
textMc.createTextField("imtext",1,0,0,thumbWidth,48); // Create a textfield in the titleMc for the image title
textMc.imtext.embedFonts = true;
textMc.imtext.text = thumbTitle; // Add text
textMc.imtext.selectable = false;
textMc.imtext.textColor = 0xaddf99; // Set textColor to pink
textMc.imtext.setTextFormat(format); // set text format
textMc.imtext._x = Math.round((thumbWidth - textMc.imtext.textWidth)/2);
textMc._y = thumbHeight - textMc.imtext._height;
textMc.attachMovie("arrow", "arrowMc", textMc.getNextHighestDepth()); // add arrow
textMc.arrowMc._x = Number(thumbWidth) - textMc.arrowMc._width;
textMc.arrowMc._y = Number(textMc.arrowMc._height);
textMc.arrowMc._alpha = 0;
textMc.scrolltxt.bg.onRollOver = function(){ // pop up scrolltxt
mainContent["tex" + newPos]._y = thumbHeight - textMc.scrolltxt.bg._height;
isReading = true;
textMc.scrolltxt.bg.onRollOut = textMc.scrolltxt.bg.onReleaseOutside = function(){ // pop down scrolltxt
if(!mainContent["tex" + newPos].scrolltxt.bg.hitTest(_root._xmouse, _root._ymouse, true)){
mainContent["tex" + newPos]._y = thumbHeight - textMc.imtext._height;
isReading = false;
function addLoader(thumb:MovieClip){ // Add a preloader to every thumbnail
mainContent.attachMovie("smallLoader", "preloader" + thumb._name, mainContent.getNextHighestDepth()); // add preloader
mainContent["preloader"+thumb._name]._x = thumb._x + (thumbWidth - mainContent["preloader"+thumb._name]._width) /2; // positioning
mainContent["preloader"+thumb._name]._y = (thumbHeight - mainContent["preloader"+thumb._name]._height) /2; // positioning
mclListener.onLoadInit = function(thumb:MovieClip) {
mainContent["preloader"+thumb._name].removeMovieClip();
mainContent[""+thumb._name].onEnterFrame = function(){ // Fade in Effect
mainContent[""+thumb._name]._alpha += Number(fadeInTime); // Every frame the alpha of the thumbnail is added by fadeInTime.
if(mainContent[""+thumb._name]._alpha >= 100){
delete mainContent[""+thumb._name].onEnterFrame; // When fade in effect is done, remove the onEnterFrame funtion
mclListener.onLoadComplete = function(thumb){ // When a thumb is fully loaded, add button action
thumb.onRelease = function(){ // When button released, execute function below
var i = Number(thumb._name)%imagesTotal;
// Go to a website defined in the xml document
thumb.onRollOver = function(){ // make alpha of arrow 100 on roll over
var i = Number(thumb._name)%imagesTotal;
mainContent["tex" + i].arrowMc._alpha = 100;
thumb.onRollOut = function(){ // make alpha of arrow 0 on roll over
var i = Number(thumb._name)%imagesTotal;
mainContent["tex" + i].arrowMc._alpha = 0;
// Button and Position Handling ///
// Left button
leftBtn.onPress = function() {
if (isReading == false){ // onPress call the next picture on the right
callPic("left");
leftBtn.onRollOver = function(){ // onRollOver move the arrow by 5 pixels
if(isReading == false){
leftBtn.arrow._x -= 5;
leftBtn.onRollOut = leftBtn.onReleaseOutside = function(){
if(isReading == false){
leftBtn.arrow._x += 5 ; // onRollOut reset the arrow
// Right button
rightBtn.onPress = function() {
if(isReading == false){
callPic("right"); // onPress call the next picture on the right
rightBtn.onRollOver = function(){
if(isReading == false){
rightBtn.arrow._x += 5 ; // onRollOver move the arrow by 5 pixels
rightBtn.onRollOut = rightBtn.onReleaseOutside = function(){
if(isReading == false){
rightBtn.arrow._x -= 5; // onRollOut reset the arrow
pieMc.onRelease = function(){
if (dwLoader != 0){ // Stops the pieLoader
dwLoader = 0;
else{
dwLoader = 100 * 3.6 / (Number(shiftTime) * 24); // Start the pieLoader
// Easing function //
//Used to give that cool ease effect on the mainContent, titleContainer and reflectContainer and dragger
// Want to change the ease effect? check help document
this.onEnterFrame = function() { // Start endless loop, executed every time frame is updated // If dragEase is false don't allow easing for the dragger
if (dwLoader != 0 && isReading == false){
arcVal += Number(dwLoader); // new value of arcVal is the old value plus dwLoader
pieMc.clear();
pieMc.beginFill(0xaddf99, 100); // draw the pie shape with pink color, you can change the color in this line
pieMc.drawPie(bckgrnd._width - 20, 20, 90, -arcVal, 7); // position the pieLoader, 90 = startAngle, 7 = radius
pieMc.endFill();
if (arcVal > 360){
shiftPic("right"); // If the pie-angle = 360 call the next picture/thumbnail
arcVal = 0;
dx = (nextXPosition - mainContent._x) * easeSpeed; // Calculates how much the mainContent needs to move, note that dx is becomming smaller and smaller when the mainContent reaches its final position.
mainContent._x += dx; // Move the mainContent
MovieClip.prototype.drawPie = function(x, y, startAngle, arc, radius) { // x, y = center point of the wedge.startAngle = starting angle in degrees.arc = sweep of the wedge. Negative values draw clockwise.
this.moveTo(x, y); // move to x,y position
var segAngle, theta, angle, angleMid, segs, startx, starty, anchx, anchy, contrx, contry; // Init vars
segs = Math.ceil(Math.abs(arc)/20); // Devide the arc in 20 segments
segAngle = arc/segs; // Calculate the sweep of each segment.
theta = -(segAngle/180)*Math.PI; // Convert to radions
angle = -(startAngle/180)*Math.PI; // Convert startAngle to radians
startx = x + Math.cos(startAngle/180*Math.PI) * radius; // Calculate curve start x position
starty = y + Math.sin(-startAngle/180*Math.PI) * radius; // Calculate curve start y position
this.lineTo(startx, starty); // Draw a line from the center to the start of the curve
for (var i = 0; i<segs; i++) { // Loop for drawing curve segments
angle += theta; // Icrement angle with segAngle => theta (in radians)
anchx = x+Math.cos(angle)*radius; // Calculate parameters for curveTo function
anchy = y+Math.sin(angle)*radius; // Calculate parameters for curveTo function
contrx = x+Math.cos(angle-(theta/2))*(radius/Math.cos(theta/2)); // Calculate parameters for curveTo function
contry = y+Math.sin(angle-(theta/2))*(radius/Math.cos(theta/2)); // Calculate parameters for curveTo function
this.curveTo(contrx, contry, anchx, anchy); // Draw the curve
this.lineTo(x, y); // close the curve by drawing a line to the centerAs is always the case in this sort of situation, you ask the printer, or banner maker. If you have a particular company in mond, they may have a website with guidelines, and that is going to be much better information than the guesses - good though 'some' of them might be.
25' by 16' is huge. Have you found somewhere that will make it? This company will supply 25 foot long banners, at a surprisingly cheap $176, but only 3 foot high. The problem being the width of the printer.
http://www.allstatebanners.com/3x25-vinyl-banner -
Hi, I'm new to after effects. I'm having trouble with exporting swf files correctly they always end up not working, with a huge file size, or in bad quality. what am i doing wrong?
Ok sorry, my bad.
I only got after affects a few weeks.
so,
I'm working on a typographic animation. each word is seperate png file, and there's 1 jpeg as background.
i have 11 layers in my comp. and basicly what i did was move them around with position keyframes and scale keyframes.
i have no effects on there, i only used easy ease function.
my comp is 310 x 160 px (web banner) 7 sec. and 24 fps
the biggest png in there is 100kb so thats not it.
and i played around with my export my export settings, too adjust the file size. either way: its too large or too minimum quality.
Enough info / any solutions? -
I'm trying to use an imported Tween class (gs.TweenLite) in
Flex to animate an object. Everything works well until I try to use
easing-- then it does not work. The problem seems to be that it
will not recognize the following:
import fl.motion.easing.Back;
How can I import some easing functions into Flex?Is it possible to control the parameters of the easing within
the Bounce method? The documentation says:
t:Number — Specifies time.
b:Number — Specifies the initial position of a
component.
c:Number — Specifies the total change in position of
the component.
d:Number — Specifies the duration of the effect, in
milliseconds.
I don't understand how I would use these. -
Link doesn't work in an external htmlText
Hello!!!
I am trying to fix this problem. My external text display fine and also the CSS. The problem is
when I am using any tag in html like <a> doesn't work, doesn't try to open the link and also the mouse
doesn't change to the default hand. I am attaching my code in AS3. If you see I am using a scroller
and also a mask. Could you try to help me please?
Thanks in advance!!!
J
var textLoader:URLLoader = new URLLoader();
var textReq:URLRequest = new URLRequest("text/news.txt");
var cssLoader:URLLoader = new URLLoader();
var cssRequest:URLRequest = new URLRequest("styles/style.css");
var style:StyleSheet = new StyleSheet();
var scrollPercent:Number = 0;
var minScroll:Number;
var maxScroll:Number;
var targetScroll:Number = text_mc.y;
var easing:Number = 5;
var scrollAmt:Number = 15;
var scrollDirection:Number = 0;
function textLoaded(event:Event):void
cssLoader.load(cssRequest);
cssLoader.addEventListener(Event.COMPLETE, cssLoaded);
text_mc.external_txt.htmlText = textLoader.data;
minScroll = text_mc.y;
maxScroll = minScroll - text_mc.height + mask_mc.height;
function cssLoaded(event:Event):void
style.parseCSS(cssLoader.data);
text_mc.external_txt.styleSheet = style;
text_mc.external_txt.htmlText = textLoader.data;
function dragScroller(event:MouseEvent):void
var dragX:Number = line_mc.x - scroller_mc.width/2 + 1;
var dragY:Number = line_mc.y;
var dragW:Number = 0;
var dragH:Number = line_mc.height - scroller_mc.height;
scroller_mc.startDrag(false, new Rectangle(dragX,dragY,dragW,dragH));
stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
stage.addEventListener(Event.ENTER_FRAME, setScrollPercent);
stage.removeEventListener(Event.ENTER_FRAME, scrollText);
function stopDragging(event:MouseEvent):void
scroller_mc.stopDrag();
function setScrollPercent(event:Event):void
scrollPercent = (scroller_mc.y - line_mc.y) / (line_mc.height - scroller_mc.height);
if(scrollPercent < 0)
scrollPercent = 0;
else if(scrollPercent > 1)
scrollPercent = 1;
targetScroll = (scrollPercent * (maxScroll - minScroll)) + minScroll;
text_mc.y -= (text_mc.y - targetScroll) / easing;
function scrollUp(event:MouseEvent):void
setDirection(scrollAmt);
function scrollDown(event:MouseEvent):void
setDirection(-scrollAmt);
function setDirection(dir:Number):void
scrollDirection = dir;
stage.addEventListener(Event.ENTER_FRAME, scrollText);
stage.addEventListener(MouseEvent.MOUSE_UP, stopScrolling);
stage.removeEventListener(Event.ENTER_FRAME, setScrollPercent);
function scrollText(event:Event):void
targetScroll += scrollDirection;
text_mc.y -= (text_mc.y - targetScroll) / easing;
if(text_mc.y > minScroll)
text_mc.y = minScroll;
targetScroll = minScroll;
else if(text_mc.y <maxScroll)
text_mc.y = maxScroll;
targetScroll = maxScroll;
scrollPercent = (text_mc.y - minScroll) / (maxScroll - minScroll);
scroller_mc.y = (scrollPercent * (line_mc.height - scroller_mc.height)) +
line_mc.y;
function stopScrolling(event:MouseEvent):void
scrollDirection = 0;
textLoader.load(textReq);
scroller_mc.buttonMode = true;
text_mc.external_txt.autoSize = TextFieldAutoSize.LEFT;
scroller_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragScroller);
textLoader.addEventListener(Event.COMPLETE, textLoaded);
up_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollUp);
down_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollDown);Hi Kglad,
I have this in news.txt:
<span class="title">FUTURE ENGAGEMENTS</span>
JUNE 2009
Dates 1,3,5,7,8,9
Role Fenton (Cover)
Event Falstaff
Company <a href="http://www.yahoo.com">Glyndebourne Opera Festival </a>
NOVEMBER 2009
<span class="titles">Dates</span> 1,3,5,7,8,9
<span class="titles">Role</span> Fenton (Cover)
<span class="titles">Event</span> Falstaff
<span class="titles">Company</span> Glyndebourne Opera Festival
Thanks!!!
J -
Hi Guys, I need help finding the right piece of Javascript code to amend in the Adora template to slow the slides down to flip every 5 or 6 seconds (5000 to 6000 milliseconds) as opposed to what I can only assume is currently 3 secs (3000 milliseconds).
I've used the default BizCatalyst file manager to "edit" line 624 of jquery.anythingslider.js from 3000 milliseconds to 6000 milliseconds with no affect.
What am I missing here? Is this not the right line? Does "editing" via BizCatalyst's File Manager not work? I'll admit it's not the most advanced File Manager around (not by a long shot) but surely it should work as it would suggest when you "edit", amend, and "save"?
I've hunted in these forums and within the other Javascript files and am having no luck.
I'm assuming the Javascript file in question is jquery.anythingslider.js. I've been through the rest of them and they don't appear to have anything to do with the slideshow. jquery.nivo.slider.pack.js might have something to do with it but... MAN... that coding is a mess. What were youu guys thinking using a Script that messy within a template that people are going to want to customise? Lift your game please - you are Adobe, not some rank amateurs. Finding a piece of code in there is like finding a needle in 100 haystacks.
Des McKenzieThanks Pat,
There is indeed a jquery.anythingslider.js file within the "JS" folder but I've tried chamging the delay from 3000 to 6000 even to 20000 but it makes no diff. Also it seems to sit for a disproportionate length of time on first load before the first scroll.
Code from jquery.anythingslider.js is:
AnythingSlider v1.5.7.3
By Chris Coyier: http://css-tricks.com
with major improvements by Doug Neiner: http://pixelgraphics.us/
based on work by Remy Sharp: http://jqueryfordesigners.com/
crazy mods by Rob Garrison (aka Mottie): https://github.com/ProLoser/AnythingSlider
To use the navigationFormatter function, you must have a function that
accepts two paramaters, and returns a string of HTML text.
index = integer index (1 based);
panel = jQuery wrapped LI item this tab references
@return = Must return a string of HTML/Text
navigationFormatter: function(index, panel){
return "Panel #" + index; // This would have each tab with the text 'Panel #X' where X = index
(function($) {
$.anythingSlider = function(el, options) {
// To avoid scope issues, use 'base' instead of 'this'
// to reference this class from internal events and functions.
var base = this;
// Wraps the ul in the necessary divs and then gives Access to jQuery element
base.$el = $(el).addClass('anythingBase').wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');
// Add a reverse reference to the DOM object
base.$el.data("AnythingSlider", base);
base.init = function(){
base.options = $.extend({}, $.anythingSlider.defaults, options);
if ($.isFunction(base.options.onBeforeInitialize)) { base.$el.bind('before_initialize', base.options.onBeforeInitialize); }
base.$el.trigger('before_initialize', base);
// Cache existing DOM elements for later
// base.$el = original ul
// for wrap - get parent() then closest in case the ul has "anythingSlider" class
base.$wrapper = base.$el.parent().closest('div.anythingSlider').addClass('anythingSlider-' + base.options.theme);
base.$window = base.$el.closest('div.anythingWindow');
base.$controls = $('<div class="anythingControls"></div>').appendTo( (base.options.appendControlsTo !== null && $(base.options.appendControlsTo).length) ? $(base.options.appendControlsTo) : base.$wrapper); // change so this works in jQuery 1.3.2
base.win = window;
base.$win = $(base.win);
base.$nav = $('<ul class="thumbNav" />').appendTo(base.$controls);
// Set up a few defaults & get details
base.timer = null; // slideshow timer (setInterval) container
base.flag = false; // event flag to prevent multiple calls (used in control click/focusin)
base.playing = false; // slideshow state
base.hovered = false; // actively hovering over the slider
base.panelSize = []; // will contain dimensions and left position of each panel
base.currentPage = base.options.startPanel;
base.adjustLimit = (base.options.infiniteSlides) ? 0 : 1; // adjust page limits for infinite or limited modes
if (base.options.playRtl) { base.$wrapper.addClass('rtl'); }
// save some options
base.original = [ base.options.autoPlay, base.options.buildNavigation, base.options.buildArrows];
base.updateSlider();
base.$currentPage = base.$items.eq(base.currentPage);
base.$lastPage = base.$currentPage;
// Get index (run time) of this slider on the page
base.runTimes = $('div.anythingSlider').index(base.$wrapper) + 1;
base.regex = new RegExp('panel' + base.runTimes + '-(\\d+)', 'i'); // hash tag regex
// Make sure easing function exists.
if (!$.isFunction($.easing[base.options.easing])) { base.options.easing = "swing"; }
// Add theme stylesheet, if it isn't already loaded
if (base.options.theme !== 'default' && !$('link[href*=' + base.options.theme + ']').length){
$('body').append('<link rel="stylesheet" href="' + base.options.themeDirectory.replace(/\{themeName\}/g, base.options.theme) + '" type="text/css" />');
// If pauseOnHover then add hover effects
if (base.options.pauseOnHover) {
base.$wrapper.hover(function() {
if (base.playing) {
base.$el.trigger('slideshow_paused', base);
base.clearTimer(true);
}, function() {
if (base.playing) {
base.$el.trigger('slideshow_unpaused', base);
base.startStop(base.playing, true);
// If a hash can not be used to trigger the plugin, then go to start panel
var startPanel = (base.options.hashTags) ? base.gotoHash() || base.options.startPanel : base.options.startPanel;
base.setCurrentPage(startPanel, false); // added to trigger events for FX code
// Hide/Show navigation & play/stop controls
base.slideControls(false);
base.$wrapper.bind('mouseenter mouseleave', function(e){
base.hovered = (e.type === "mouseenter") ? true : false;
base.slideControls( base.hovered, false );
// Add keyboard navigation
if (base.options.enableKeyboard) {
$(document).keyup(function(e){
if (base.$wrapper.is('.activeSlider')) {
switch (e.which) {
case 39: // right arrow
base.goForward();
break;
case 37: //left arrow
base.goBack();
break;
// Binds events
var triggers = "slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" ");
$.each("onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "), function(i,o){
if ($.isFunction(base.options[o])){
base.$el.bind(triggers[i], base.options[o]);
if ($.isFunction(base.options.onSlideComplete)){
// Added setTimeout (zero time) to ensure animation is complete... see this bug report: http://bugs.jquery.com/ticket/7157
base.$el.bind('slide_complete', function(){
setTimeout(function(){ base.options.onSlideComplete(base); }, 0);
base.$el.trigger('initialized', base);
// called during initialization & to update the slider if a panel is added or deleted
base.updateSlider = function(){
// needed for updating the slider
base.$el.find('li.cloned').remove();
base.$nav.empty();
base.$items = base.$el.find('> li');
base.pages = base.$items.length;
// Set the dimensions of each panel
if (base.options.resizeContents) {
if (base.options.width) { base.$wrapper.add(base.$items).css('width', base.options.width); }
if (base.options.height) { base.$wrapper.add(base.$items).css('height', base.options.height); }
// Remove navigation & player if there is only one page
if (base.pages === 1) {
base.options.autoPlay = false;
base.options.buildNavigation = false;
base.options.buildArrows = false;
base.$controls.hide();
base.$nav.hide();
if (base.$forward) { base.$forward.add(base.$back).hide(); }
} else {
base.options.autoPlay = base.original[0];
base.options.buildNavigation = base.original[1];
base.options.buildArrows = base.original[2];
base.$controls.show();
base.$nav.show();
if (base.$forward) { base.$forward.add(base.$back).show(); }
// Build navigation tabs
base.buildNavigation();
// If autoPlay functionality is included, then initialize the settings
if (base.options.autoPlay) {
base.playing = !base.options.startStopped; // Sets the playing variable to false if startStopped is true
base.buildAutoPlay();
// Build forwards/backwards buttons
if (base.options.buildArrows) { base.buildNextBackButtons(); }
// Top and tail the list with 'visible' number of items, top has the last section, and tail has the first
// This supports the "infinite" scrolling, also ensures any cloned elements don't duplicate an ID
base.$el.prepend( (base.options.infiniteSlides) ? base.$items.filter(':last').clone().addClass('cloned').removeAttr('id') : $('<li class="cloned" />') );
base.$el.append( (base.options.infiniteSlides) ? base.$items.filter(':first').clone().addClass('cloned').removeAttr('id') : $('<li class="cloned" />') );
base.$el.find('li.cloned').each(function(){
// replace <a> with <span> in cloned panels to prevent shifting the panels by tabbing - modified so this will work with jQuery 1.3.2
$(this).html( $(this).html().replace(/<a/gi, '<span').replace(/\/a>/gi, '/span>') );
$(this).find('[id]').removeAttr('id');
// We just added two items, time to re-cache the list, then get the dimensions of each panel
base.$items = base.$el.find('> li').addClass('panel');
base.setDimensions();
if (!base.options.resizeContents) { base.$win.load(function(){ base.setDimensions(); }); } // set dimensions after all images load
if (base.currentPage > base.pages) {
base.currentPage = base.pages;
base.setCurrentPage(base.pages, false);
base.$nav.find('a').eq(base.currentPage - 1).addClass('cur'); // update current selection
base.hasEmb = base.$items.find('embed[src*=youtube]').length; // embedded youtube objects exist in the slider
base.hasSwfo = (typeof(swfobject) !== 'undefined' && swfobject.hasOwnProperty('embedSWF') && $.isFunction(swfobject.embedSWF)) ? true : false; // is swfobject loaded?
// Initialize YouTube javascript api, if YouTube video is present
if (base.hasEmb && base.hasSwfo) {
base.$items.find('embed[src*=youtube]').each(function(i){
// Older IE doesn't have an object - just make sure we are wrapping the correct element
var $tar = ($(this).parent()[0].tagName === "OBJECT") ? $(this).parent() : $(this);
$tar.wrap('<div id="ytvideo' + i + '"></div>');
// use SWFObject if it exists, it replaces the wrapper with the object/embed
swfobject.embedSWF($(this).attr('src') + '&enablejsapi=1&version=3&playerapiid=ytvideo' + i, 'ytvideo' + i,
$tar.attr('width'), $tar.attr('height'), '10', null, null,
{ allowScriptAccess: "always", wmode : base.options.addWmodeToObject, allowfullscreen : true },
{ 'class' : $tar.attr('class'), 'style' : $tar.attr('style') },
function(){ if (i >= base.hasEmb - 1) { base.$el.trigger('swf_completed', base); } } // swf callback
// Fix tabbing through the page
base.$items.find('a').unbind('focus').bind('focus', function(e){
base.$items.find('.focusedLink').removeClass('focusedLink');
$(this).addClass('focusedLink');
var panel = $(this).closest('.panel');
if (!panel.is('.activePage')) {
base.gotoPage(base.$items.index(panel));
e.preventDefault();
// Creates the numbered navigation links
base.buildNavigation = function() {
if (base.options.buildNavigation && (base.pages > 1)) {
base.$items.filter(':not(.cloned)').each(function(i,el) {
var index = i + 1,
klass = ((index === 1) ? 'first' : '') + ((index === base.pages) ? 'last' : ''),
$a = $('<a href="#"></a>').addClass('panel' + index).wrap('<li class=" + klass + " />');
base.$nav.append($a.parent()); // use $a.parent() so IE will add <li> instead of only the <a> to the <ul>
// If a formatter function is present, use it
if ($.isFunction(base.options.navigationFormatter)) {
var tmp = base.options.navigationFormatter(index, $(this));
$a.html(tmp);
// Add formatting to title attribute if text is hidden
if (parseInt($a.css('text-indent'),10) < 0) { $a.addClass(base.options.tooltipClass).attr('title', tmp); }
} else {
$a.text(index);
$a.bind(base.options.clickControls, function(e) {
if (!base.flag && base.options.enableNavigation) {
// prevent running functions twice (once for click, second time for focusin)
base.flag = true; setTimeout(function(){ base.flag = false; }, 100);
base.gotoPage(index);
if (base.options.hashTags) { base.setHash(index); }
e.preventDefault();
// Creates the Forward/Backward buttons
base.buildNextBackButtons = function() {
if (base.$forward) { return; }
base.$forward = $('<span class="arrow forward"><a href="#">' + base.options.forwardText + '</a></span>');
base.$back = $('<span class="arrow back"><a href="#">' + base.options.backText + '</a></span>');
// Bind to the forward and back buttons
base.$back.bind(base.options.clickArrows, function(e) {
base.goBack();
e.preventDefault();
base.$forward.bind(base.options.clickArrows, function(e) {
base.goForward();
e.preventDefault();
// using tab to get to arrow links will show they have focus (outline is disabled in css)
base.$back.add(base.$forward).find('a').bind('focusin focusout',function(){
$(this).toggleClass('hover');
// Append elements to page
base.$wrapper.prepend(base.$forward).prepend(base.$back);
base.$arrowWidth = base.$forward.width();
// Creates the Start/Stop button
base.buildAutoPlay = function(){
if (base.$startStop) { return; }
base.$startStop = $("<a href='#' class='start-stop'></a>").html(base.playing ? base.options.stopText : base.options.startText);
base.$controls.prepend(base.$startStop);
base.$startStop
.bind(base.options.clickSlideshow, function(e) {
if (base.options.enablePlay) {
base.startStop(!base.playing);
if (base.playing) {
if (base.options.playRtl) {
base.goBack(true);
} else {
base.goForward(true);
e.preventDefault();
// show button has focus while tabbing
.bind('focusin focusout',function(){
$(this).toggleClass('hover');
// Use the same setting, but trigger the start;
base.startStop(base.playing);
// Set panel dimensions to either resize content or adjust panel to content
base.setDimensions = function(){
var w, h, c, cw, dw, leftEdge = 0, bww = base.$window.width(), winw = base.$win.width();
base.$items.each(function(i){
c = $(this).children('*');
if (base.options.resizeContents){
// get viewport width & height from options (if set), or css
w = parseInt(base.options.width,10) || bww;
h = parseInt(base.options.height,10) || base.$window.height();
// resize panel
$(this).css({ width: w, height: h });
// resize panel contents, if solitary (wrapped content or solitary image)
if (c.length === 1){
c.css({ width: '100%', height: '100%' });
if (c[0].tagName === "OBJECT") { c.find('embed').andSelf().attr({ width: '100%', height: '100%' }); }
} else {
// get panel width & height and save it
w = $(this).width(); // if not defined, it will return the width of the ul parent
dw = (w >= winw) ? true : false; // width defined from css?
if (c.length === 1 && dw){
cw = (c.width() >= winw) ? bww : c.width(); // get width of solitary child
$(this).css('width', cw); // set width of panel
c.css('max-width', cw); // set max width for all children
w = cw;
w = (dw) ? base.options.width || bww : w;
$(this).css('width', w);
h = $(this).outerHeight(); // get height after setting width
$(this).css('height', h);
base.panelSize[i] = [w,h,leftEdge];
leftEdge += w;
// Set total width of slider, but don't go beyond the set max overall width (limited by Opera)
base.$el.css('width', (leftEdge < base.options.maxOverallWidth) ? leftEdge : base.options.maxOverallWidth);
base.gotoPage = function(page, autoplay, callback) {
if (base.pages === 1) { return; }
base.$lastPage = base.$items.eq(base.currentPage);
if (typeof(page) !== "number") {
page = base.options.startPage;
base.setCurrentPage(base.options.startPage);
// pause YouTube videos before scrolling or prevent change if playing
if (base.hasEmb && base.checkVideo(base.playing)) { return; }
if (page > base.pages + 1 - base.adjustLimit) { page = (!base.options.infiniteSlides && !base.options.stopAtEnd) ? 1 : base.pages; }
if (page < base.adjustLimit ) { page = (!base.options.infiniteSlides && !base.options.stopAtEnd) ? base.pages : 1; }
base.$currentPage = base.$items.eq(page);
base.currentPage = page; // ensure that event has correct target page
base.$el.trigger('slide_init', base);
base.slideControls(true, false);
// When autoplay isn't passed, we stop the timer
if (autoplay !== true) { autoplay = false; }
// Stop the slider when we reach the last page, if the option stopAtEnd is set to true
if (!autoplay || (base.options.stopAtEnd && page === base.pages)) { base.startStop(false); }
base.$el.trigger('slide_begin', base);
// resize slider if content size varies
if (!base.options.resizeContents) {
// animating the wrapper resize before the window prevents flickering in Firefox
base.$wrapper.filter(':not(:animated)').animate(
{ width: base.panelSize[page][0], height: base.panelSize[page][1] },
{ queue: false, duration: base.options.animationTime, easing: base.options.easing }
// Animate Slider
base.$window.filter(':not(:animated)').animate(
{ scrollLeft : base.panelSize[page][2] },
{ queue: false, duration: base.options.animationTime, easing: base.options.easing, complete: function(){ base.endAnimation(page, callback); } }
base.endAnimation = function(page, callback){
if (page === 0) {
base.$window.scrollLeft(base.panelSize[base.pages][2]);
page = base.pages;
} else if (page > base.pages) {
// reset back to start position
base.$window.scrollLeft(base.panelSize[1][2]);
page = 1;
base.setCurrentPage(page, false);
// Add active panel class
base.$items.removeClass('activePage').eq(page).addClass('activePage');
if (!base.hovered) { base.slideControls(false); }
// continue YouTube video if in current panel
if (base.hasEmb){
var emb = base.$currentPage.find('object[id*=ytvideo], embed[id*=ytvideo]');
// player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
if (emb.length && $.isFunction(emb[0].getPlayerState) && emb[0].getPlayerState() > 0 && emb[0].getPlayerState() !== 5) {
emb[0].playVideo();
base.$el.trigger('slide_complete', base);
// callback from external slide control: $('#slider').anythingSlider(4, function(slider){ })
if (typeof callback === 'function') { callback(base); }
// Continue slideshow after a delay
if (base.options.autoPlayLocked && !base.playing) {
setTimeout(function(){
base.startStop(true);
// subtract out slide delay as the slideshow waits that additional time.
}, base.options.resumeDelay - base.options.delay);
base.setCurrentPage = function(page, move) {
if (page > base.pages + 1 - base.adjustLimit) { page = base.pages - base.adjustLimit; }
if (page < base.adjustLimit ) { page = 1; }
// Set visual
if (base.options.buildNavigation){
base.$nav.find('.cur').removeClass('cur');
base.$nav.find('a').eq(page - 1).addClass('cur');
// hide/show arrows based on infinite scroll mode
if (!base.options.infiniteSlides && base.options.stopAtEnd){
base.$wrapper.find('span.forward')[ page === base.pages ? 'addClass' : 'removeClass']('disabled');
base.$wrapper.find('span.back')[ page === 1 ? 'addClass' : 'removeClass']('disabled');
if (page === base.pages && base.playing) { base.startStop(); }
// Only change left if move does not equal false
if (!move) {
base.$wrapper.css({
width: base.panelSize[page][0],
height: base.panelSize[page][1]
base.$wrapper.scrollLeft(0); // reset in case tabbing changed this scrollLeft
base.$window.scrollLeft( base.panelSize[page][2] );
// Update local variable
base.currentPage = page;
// Set current slider as active so keyboard navigation works properly
if (!base.$wrapper.is('.activeSlider')){
$('.activeSlider').removeClass('activeSlider');
base.$wrapper.addClass('activeSlider');
base.goForward = function(autoplay) {
if (autoplay !== true) { autoplay = false; base.startStop(false); }
base.gotoPage(base.currentPage + 1, autoplay);
base.goBack = function(autoplay) {
if (autoplay !== true) { autoplay = false; base.startStop(false); }
base.gotoPage(base.currentPage - 1, autoplay);
// This method tries to find a hash that matches panel-X
// If found, it tries to find a matching item
// If that is found as well, then that item starts visible
base.gotoHash = function(){
var n = base.win.location.hash.match(base.regex);
return (n===null) ? '' : parseInt(n[1],10);
base.setHash = function(n){
var s = 'panel' + base.runTimes + '-',
h = base.win.location.hash;
if ( typeof h !== 'undefined' ) {
base.win.location.hash = (h.indexOf(s) > 0) ? h.replace(base.regex, s + n) : h + "&" + s + n;
// Slide controls (nav and play/stop button up or down)
base.slideControls = function(toggle, playing){
var dir = (toggle) ? 'slideDown' : 'slideUp',
t1 = (toggle) ? 0 : base.options.animationTime,
t2 = (toggle) ? base.options.animationTime: 0,
sign = (toggle) ? 0 : 1; // 0 = visible, 1 = hidden
if (base.options.toggleControls) {
base.$controls.stop(true,true).delay(t1)[dir](base.options.animationTime/2).delay(t2);
if (base.options.buildArrows && base.options.toggleArrows) {
if (!base.hovered && base.playing) { sign = 1; t2 = 0; } // don't animate arrows during slideshow
base.$forward.stop(true,true).delay(t1).animate({ right: sign * base.$arrowWidth, opacity: t2 }, base.options.animationTime/2);
base.$back.stop(true,true).delay(t1).animate({ left: sign * base.$arrowWidth, opacity: t2 }, base.options.animationTime/2);
base.clearTimer = function(paused){
// Clear the timer only if it is set
if (base.timer) {
base.win.clearInterval(base.timer);
if (!paused) {
base.$el.trigger('slideshow_stop', base);
// Handles stopping and playing the slideshow
// Pass startStop(false) to stop and startStop(true) to play
base.startStop = function(playing, paused) {
if (playing !== true) { playing = false; } // Default if not supplied is false
if (playing && !paused) {
base.$el.trigger('slideshow_start', base);
// Update variable
base.playing = playing;
// Toggle playing and text
if (base.options.autoPlay) {
base.$startStop.toggleClass('playing', playing).html( playing ? base.options.stopText : base.options.startText );
// add button text to title attribute if it is hidden by text-indent
if (parseInt(base.$startStop.css('text-indent'),10) < 0) {
base.$startStop.addClass(base.options.tooltipClass).attr('title', playing ? 'Stop' : 'Start');
if (playing){
base.clearTimer(true); // Just in case this was triggered twice in a row
base.timer = base.win.setInterval(function() {
// prevent autoplay if video is playing
if (!(base.hasEmb && base.checkVideo(playing))) {
if (base.options.playRtl) {
base.goBack(true);
} else {
base.goForward(true);
}, base.options.delay);
} else {
base.clearTimer();
base.checkVideo = function(playing){
// pause YouTube videos before scrolling?
var emb, ps, stopAdvance = false;
base.$items.find('object[id*=ytvideo], embed[id*=ytvideo]').each(function(){ // include embed for IE; if not using SWFObject, old detach/append code needs "object embed" here
emb = $(this);
if (emb.length && $.isFunction(emb[0].getPlayerState)) {
// player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
ps = emb[0].getPlayerState();
// if autoplay, video playing, video is in current panel and resume option are true, then don't advance
if (playing && (ps === 1 || ps > 2) && base.$items.index(emb.closest('li.panel')) === base.currentPage && base.options.resumeOnVideoEnd) {
stopAdvance = true;
} else {
// pause video if not autoplaying (if already initialized)
if (ps > 0) { emb[0].pauseVideo(); }
return stopAdvance;
// Trigger the initialization
base.init();
$.anythingSlider.defaults = {
// Appearance
width : null, // Override the default CSS width
height : null, // Override the default CSS height
resizeContents : true, // If true, solitary images/objects in the panel will expand to fit the viewport
tooltipClass : 'tooltip', // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent)
theme : 'default', // Theme name
themeDirectory : 'css/theme-{themeName}.css', // Theme directory & filename {themeName} is replaced by the theme value above
// Navigation
startPanel : 1, // This sets the initial panel
hashTags : true, // Should links change the hashtag in the URL?
infiniteSlides : true, // if false, the slider will not wrap
enableKeyboard : true, // if false, keyboard arrow keys will not work for the current panel.
buildArrows : true, // If true, builds the forwards and backwards buttons
toggleArrows : false, // If true, side navigation arrows will slide out on hovering & hide @ other times
buildNavigation : true, // If true, builds a list of anchor links to link to each panel
enableNavigation : true, // if false, navigation links will still be visible, but not clickable.
toggleControls : false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times
appendControlsTo : null, // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null
navigationFormatter : null, // Details at the top of the file on this use (advanced use)
forwardText : "»", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image)
backText : "«", // Link text used to move the slider back (hidden by CSS, replace with arrow image)
// Slideshow options
enablePlay : true, // if false, the play/stop button will still be visible, but not clickable.
autoPlay : true, // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
autoPlayLocked : false, // If true, user changing slides will not stop the slideshow
startStopped : false, // If autoPlay is on, this can force it to start stopped
pauseOnHover : true, // If true & the slideshow is active, the slideshow will pause on hover
resumeOnVideoEnd : true, // If true & the slideshow is active & a youtube video is playing, it will pause the autoplay until the video is complete
stopAtEnd : false, // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false.
playRtl : false, // If true, the slideshow will move right-to-left
startText : "Start", // Start button text
stopText : "Stop", // Stop button text
delay : 6000, // How long between slideshow transitions in AutoPlay mode (in milliseconds)
resumeDelay : 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
animationTime : 600, // How long the slideshow transition takes (in milliseconds)
easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin
// Callbacks - removed from options to reduce size - they still work
// Interactivity
clickArrows : "click", // Event used to activate arrow functionality (e.g. "click" or "mouseenter")
clickControls : "click focusin", // Events used to activate navigation control functionality
clickSlideshow : "click", // Event used to activate slideshow play/stop button
// Misc options
addWmodeToObject : "opaque", // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting
maxOverallWidth : 32766 // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera
$.fn.anythingSlider = function(options, callback) {
return this.each(function(i){
var anySlide = $(this).data('AnythingSlider');
// initialize the slider but prevent multiple initializations
if ((typeof(options)).match('object|undefined')){
if (!anySlide) {
(new $.anythingSlider(this, options));
} else {
anySlide.updateSlider();
// If options is a number, process as an external link to page #: $(element).anythingSlider(#)
} else if (/\d/.test(options) && !isNaN(options) && anySlide) {
var page = (typeof(options) === "number") ? options : parseInt($.trim(options),10); // accepts " 2 "
// ignore out of bound pages
if ( page >= 1 && page <= anySlide.pages ) {
anySlide.gotoPage(page, false, callback); // page #, autoplay, one time callback
})(jQuery);
/* AnythingSlider works with works with jQuery 1.4+, but you can uncomment the code below to make it
work with jQuery 1.3.2. You'll have to manually add the code below to the minified copy if needed */
// Copied from jQuery 1.4.4 to make AnythingSlider backwards compatible to jQuery 1.3.2
if (typeof jQuery.fn.delay === 'undefined') {
jQuery.fn.extend({
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; type = type || "fx";
return this.queue( type, function() { var elem = this; setTimeout(function() { jQuery.dequeue( elem, type ); }, time ); }); -
Scrolling in a Flash App on a mobile device. Anyone?
In my opinion, the biggest different between a flash app on a computer desktop vs a flash app on a mobile device is the scrolling behavior.
A flash app on a computer desktop usually has a scrollbar and you click on the up/down arrows or the scrollbar to scroll. But on a mobile device, this scrolling is done with a swipe of the finger through the screen either horizontally or vertically.
Has anyone had any success implementing this scrolling behavior on a mobile device with a flash app?
If so, what technique did you use?Dissipation, Can you possibly post your method of scrolling? For a comparison, i have been trying to get this scrolling to work for ages.
I have this:
var ease:int = 6
var targX:int = dragMe.x
var targY:int = dragMe.y
var drag:Boolean = false
var ptX:int
var ptY:int
dragMe.cacheAsBitmap = true;
function down(sprite:Sprite):void{
//ptX = sprite.x - mouseX
ptY = sprite.y - mouseY
drag = true
function dragC(sprite:Sprite):void{
if (drag) {
//targX = mouseX+ptX;
targY = mouseY+ptY;
//trace ('targX ' +targX)
//trace ('ptX ' +ptX)
if (sprite.x != targX || sprite.y != targY) {
//sprite.x += (targX-sprite.x)/ease;
sprite.y += (targY-sprite.y)/ease;
function up(sprite:Sprite):void {
drag = false;
stage.addEventListener(Event.ENTER_FRAME, dragHandler)
stage.addEventListener(MouseEvent.MOUSE_DOWN, downHandler)
stage.addEventListener(MouseEvent.MOUSE_UP, upHandler)
function dragHandler(event:Event):void { dragC(dragMe) }
function upHandler(event:MouseEvent):void { up(dragMe) }
function downHandler(event:MouseEvent)
This works fine, it scrolls with easing, but on the device its quite slow, i mean its not jumpy but once flicked it scrolls very slow. Even if i changed the variable: ease -
I'm useing "Elastic" as a easer for a Move animation. The elastic bounces a bit too much for my taste. Is there a failry easy way to modify the amount of "bouncing" it does? (I'm going to post this as another question as well, regarding the public variables)
mxml CODE to define animation/effect:
<fx:Declarations>
<s:Move id="moveRight" target="
{blackBox}"duration="
1200"xTo="
{changeX}"yTo="
{changeY}"easer="
{stretchIt}" />
<s:Elastic id="stretchIt" />
</fx:Declarations>
AS CODE:
// incrementor variable to keep track of where the infoBox is currently[Bindable] public var currMS:uint = 1;[
Bindable] public var changeX:Number = 0;[
Bindable] public var changeY:Number = 0;
// Keeps track of the current MileStone // main function including case statementspublic
function chooseMS(event:MouseEvent):void{
switch(currMS){
case 1: // to Milestone 2
//blackBox.move(50,130);currMS++;
changeX = 50;
changeY = 130;
wgText.text = ebs_newMS2;
ow2.visible =
true;wh2.visible =
true;
moveRight.end();moveRight.play();
break;
... the rest of the switched cases are here...I extended Elastic and override the ease() function.
To achieve the effect you see in the sample code, I changed the amplitude to 1 and the period to .6.
If this post answers your question or helps, please mark it as such. Thanks!
http://www.stardustsystems.com
Adobe Flex Development and Support Services
------------- myComponents/MyElastic.mxml -------------
<?xml version="1.0" encoding="utf-8"?>
<s:Elastic xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
import mx.effects.easing.Elastic;
private var totalChange:Number = 1;
private var duration:Number = 1;
private var amplitude:Number = 1;
private var period:Number = .6;
override public function ease(fraction:Number):Number
return mx.effects.easing.Elastic.easeOut(fraction, 0,
totalChange, duration, amplitude, period);
]]>
</fx:Script>
</s:Elastic>
------------- test.mxml (main app) -----------------
<?xml version="1.0"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comp="myComponents.*">
<fx:Declarations>
<s:Bounce id="bounceEasing"/>
<comp:MyElastic id="elasticEasing"/>
<s:Move id="moveRight" target="{myImage}"
xBy="500" duration="2000" easer="{elasticEasing}"/>
<s:Move id="moveLeft" target="{myImage}" xBy="-500"
duration="2000" easer="{bounceEasing}"/>
</fx:Declarations>
<s:Panel id="examplePanel"
title="Bounce and Elastic Effect Example"
width="800" height="75%">
<s:HGroup id="detailsBox" width="50%" top="5" left="5">
<s:Label width="99%" color="blue"
text="Click the buttons to watch the effect."/>
<s:Button label="Move Right" bottom="10" left="5"
click="moveRight.end();moveRight.play();"/>
<s:Button label="Move Left" bottom="10" left="100"
click="moveLeft.end();moveLeft.play();"/>
</s:HGroup>
<mx:Image id="myImage" top="40" width="200"
source="@Embed(source='assets/logo.jpg')"/>
</s:Panel>
</s:Application> -
Hi All,
I want to be able to have a full screen image with text overlaying it in the centre. I want the full screen image to respond to the size of the viewport. I have the following code which works for the opening screen image.
CSS:
h1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 3vh;
text-align: left;
html, body, #a {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
#a {
display: table;
background-color: #0CF;
#b {
display: table-cell;
margin: 0;
padding: 0;
text-align: center;
vertical-align: middle;
#content {
border: 5px solid red;
width: 90%;
height: auto;
margin: auto;
HTML:
<div id="a">
<div id="b">
<div id="content">
<h1>THIS IS MY HEADING</h1>
</div>
</div>
</div>
I want to be able to replicate this down my page. I can simply copy and paste the Html and it works but it obviously runs off the same CSS. If i change the div id name and copy the CSS code and rename that, it stops working.
Any help would be great on this as I really need this to work for my design.
If you need me to elaborate more just let me know.
Cheers,
AlexIs this the kind of solution you are looking for?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,300,300italic,300|Droid+Ser if:400,400italic' rel='stylesheet' type='text/css'>
<style>
html {
height:100%;
body {
background: #fff;
color: #878787;
font-weight:300;
font-family: 'Source Sans Pro', sans-serif;
font-size: 16px;
text-align:left;
height:100%;
padding: 0;
margin: 0;
.fullScreen {
width:100%;
height:100%;
display: table;
.fullScreen .fullScreenText {
display: table-cell;
text-align: center;
vertical-align: middle;
.fullScreen .fullScreenText p {
text-align:center;
.fullScreen h2 {
font-size: 30px;
color: #fff;
text-align: center;
.fullScreen a {
text-decoration: none;
display: inline-block;
background-color:#C90;
color: #fff;
padding: 15px 25px;
font-weight: 600;
</style>
</head>
<body>
<div class="fullScreen" id="panel1" style="background: #f2f2f2 url('http://pixabay.com/static/uploads/photo/2012/04/26/20/06/butterfly-43008_640.jpg') no-repeat scroll center right; -webkit-background-size: cover; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;">
<div class="fullScreenText">
<h2>Some text goes here for the home page</h2>
<a href="#panel2" data-scroll data-speed="800" data-easing="easeInOutQuad">About Us</a>
</div>
</div>
<div class="fullScreen" id="panel2" style="background: #f2f2f2 url('http://pixabay.com/static/uploads/photo/2014/10/29/17/19/butterfly-508143_640.jpg') no-repeat scroll center right; -webkit-background-size: cover; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;">
<div class="fullScreenText">
<h2>Some text goes here for the about page</h2>
<a href="#panel1" data-scroll data-speed="800" data-easing="easeInOutQuad">Home</a>
</div>
</div>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script>
/* =============================================================
Smooth Scroll 3.2
Animate scrolling to anchor links, by Chris Ferdinandi.
http://gomakethings.com
Easing support contributed by Willem Liu.
https://github.com/willemliu
Easing functions forked from Gaëtan Renaudeau.
https://gist.github.com/gre/1650294
URL history support contributed by Robert Pate.
https://github.com/robertpateii
Fixed header support contributed by Arndt von Lucadou.
https://github.com/a-v-l
Infinite loop bugs in iOS and Chrome (when zoomed) by Alex Guzman.
https://github.com/alexguzman
Free to use under the MIT License.
http://gomakethings.com/mit/
* ============================================================= */
window.smoothScroll = (function (window, document, undefined) {
'use strict';
// Feature Test
if ( 'querySelector' in document && 'addEventListener' in window && Array.prototype.forEach ) {
// SELECTORS
var scrollToggles = document.querySelectorAll('[data-scroll]');
// METHODS
// Run the smooth scroll animation
var runSmoothScroll = function (anchor, duration, easing, url) {
// SELECTORS
var startLocation = window.pageYOffset;
// Get the height of a fixed header if one exists
var scrollHeader = document.querySelector('[data-scroll-header]');
var headerHeight = scrollHeader === null ? 0 : scrollHeader.offsetHeight;
// Set the animation variables to 0/undefined.
var timeLapsed = 0;
var percentage, position;
// METHODS
// Calculate the easing pattern
var easingPattern = function (type, time) {
if ( type == 'easeInQuad' ) return time * time; // accelerating from zero velocity
if ( type == 'easeOutQuad' ) return time * (2 - time); // decelerating to zero velocity
if ( type == 'easeInOutQuad' ) return time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration
if ( type == 'easeInCubic' ) return time * time * time; // accelerating from zero velocity
if ( type == 'easeOutCubic' ) return (--time) * time * time + 1; // decelerating to zero velocity
if ( type == 'easeInOutCubic' ) return time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration
if ( type == 'easeInQuart' ) return time * time * time * time; // accelerating from zero velocity
if ( type == 'easeOutQuart' ) return 1 - (--time) * time * time * time; // decelerating to zero velocity
if ( type == 'easeInOutQuart' ) return time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration
if ( type == 'easeInQuint' ) return time * time * time * time * time; // accelerating from zero velocity
if ( type == 'easeOutQuint' ) return 1 + (--time) * time * time * time * time; // decelerating to zero velocity
if ( type == 'easeInOutQuint' ) return time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration
return time; // no easing, no acceleration
// Update the URL
var updateURL = function (url, anchor) {
if ( url === 'true' && history.pushState ) {
history.pushState( {pos:anchor.id}, '', '#' + anchor.id );
// Calculate how far to scroll
var getEndLocation = function (anchor) {
var location = 0;
if (anchor.offsetParent) {
do {
location += anchor.offsetTop;
anchor = anchor.offsetParent;
} while (anchor);
location = location - headerHeight;
if ( location >= 0 ) {
return location;
} else {
return 0;
var endLocation = getEndLocation(anchor);
var distance = endLocation - startLocation;
// Stop the scrolling animation when the anchor is reached (or at the top/bottom of the page)
var stopAnimation = function () {
var currentLocation = window.pageYOffset;
if ( position == endLocation || currentLocation == endLocation || ( (window.innerHeight + currentLocation) >= document.body.scrollHeight ) ) {
clearInterval(runAnimation);
// Scroll the page by an increment, and check if it's time to stop
var animateScroll = function () {
timeLapsed += 16;
percentage = ( timeLapsed / duration );
percentage = ( percentage > 1 ) ? 1 : percentage;
position = startLocation + ( distance * easingPattern(easing, percentage) );
window.scrollTo( 0, position );
stopAnimation();
// EVENTS, LISTENERS, AND INITS
updateURL(url, anchor);
var runAnimation = setInterval(animateScroll, 16);
// Check that anchor exists and run scroll animation
var handleToggleClick = function (event) {
// SELECTORS
// Get anchor link and calculate distance from the top
var dataID = this.getAttribute('href');
var dataTarget = document.querySelector(dataID);
var dataSpeed = this.getAttribute('data-speed');
var dataEasing = this.getAttribute('data-easing');
var dataURL = this.getAttribute('data-url');
// EVENTS, LISTENERS, AND INITS
event.preventDefault();
if (dataTarget) {
runSmoothScroll( dataTarget, dataSpeed || 500, dataEasing || 'easeInOutCubic', dataURL || 'false' );
// EVENTS, LISTENERS, AND INITS
// When a toggle is clicked, run the click handler
Array.prototype.forEach.call(scrollToggles, function (toggle, index) {
toggle.addEventListener('click', handleToggleClick, false);
// Return to the top of the page when back button is clicked and no hash is set
window.onpopstate = function (event) {
if ( event.state === null && window.location.hash === '' ) {
window.scrollTo( 0, 0 );
})(window, document);
</script>
</body>
</html> -
Making an Object Move (Smoothly) in AS3
Hi again, I think I might of already posted this, but the forums are loading at about 400k a sec so I don't feel like wwasting another 25 minutes just look through the first page of threads or my history.
I have an object that I want to smoothly move along the x axis when the user clicks on the screen. I first made a prototype that would make the ball end at a location I specified by doing x = 450;. I then tried looping ball1.x += 1 with a for/do (I encapsulated it with a boolean so the if ball1.x got to 450 it would stop) statement and I couldn't see the ball transition, I just saw it stop at the 450 mark. Anyone know how to do this? I know you do because I've seen you it.
BTW, the reason I didn't just do a motion tween was because I have it set up so you can move it along the y axis by moving the mouse. Thanks in advance.You can find all of the information about the Tween class in the help documentation.
Here's a line copied from the Tween constructor section.
public function Tween(obj:Object, prop:String, func:Function, begin:Number, finish:Number, duration:Number, useSeconds:Boolean = false)
Parameters
obj:Object — Object that the Tween targets.
prop:String — Name of the property (obj parameter value) that will be affected.
func:Function — Name of the easing function to use.
begin:Number — Starting value of the prop parameter.
finish:Number — A number indicating the ending value of prop parameter (the target object property to be tweened).
duration:Number — Length of time of the motion; set to infinity if negative or omitted.
useSeconds:Boolean (default = false) — A flag specifying whether to use seconds instead of frames. The function uses seconds if true or frames in relation to the value specified in the duration parameter if false.
Maybe you are looking for
-
No VM, No Edge/3G, random shut-downs since iOS4 Update after restores
I have followed all of the fixes I could find and I still do not have a notification that I have a vm, I do not get any internet service via 3G or Edge, and the phone shuts down and cannot be turned back on for for several minutes (happens randomly).
-
SSRS 2008 Matrix - Column Data Incorrect
I am trying to convert an old local Crystal Report. Basically, for a given order, there are multiple line items. The report needs to show Order and Vendor in the left two columns, then a variable number of columns (that fit on a page) to display the
-
Error during running crystal report when the region setting to Vietnamese
I have a report called stock movement which stockmovement.rpt file. It has some formula field where the formula is onlastrecord; numbervar SysClosingQty; IF {usp_Rpt_Crystal_StockMovement;1.ReferenceNumber}="" OR IsNull({usp_Rpt_Crystal_StockMovement
-
How to schedule an action in Acrobat X to run at night?
I am trying to run optimize action on a folder every night or so but i cant find a way to do it. Hopefully it will run without having to start Acrobat itself. Thanks
-
Which speakers will work on my DVD player?
Hello Recently I bought DVD Player Philips DVP 500 and now I want also to buy 5.1 speakers. DVD player has 1x Digital Audio Coaxial output,so Im thinking of buying Inspire GD580. Is my choice correct one? Since I have nevered bought hardware online,I