Hi,
I've been trying to create a carousel class which takes an array of phrases and then creates a textfield for each one positioning it vertically based on the order it was added. The next stage would be for it to make the phrases move down the _y axis until they reach the limit of the container. The phrases need to then swap onto a container behind or drop depths so they are behind the other phrases and then make their way back up. The general idea being like an upright carousel.
I first tried to create it in one class (PhraseCarousel ), but then i thought maybe it would be better to separate it into two classes so there's one for the phrase objects aswell (PhraseObject), i did this because i was thinking that i should give the moving behaviour to the phrase objects instead of dealing with that in the carousel.
Anyway where I'm struggling at the moment is how to best add the PhraseObject instances, do I attach them to the main timeline or do i add them to an array on the main timeline and then pass them to the carousel class?
I'm a bit new to OOP so my code is not really making all that much sense at the moment: -
class PhraseObject extends MovieClip {
-
-
private var phrase:String;
-
private var textObject:TextField;
-
private var startPositionY:Number;
-
private static var count:Number = 0;
-
private static var mTimeLine;
-
private var depth:Number;
-
private var container:MovieClip;
-
-
function PhraseObject(pTimeLine:MovieClip,phrase:String,startPositionY:Number) {
-
-
// Initialise variables
-
trace("PhraseObject, initialising...");
-
this.phrase = phrase;
-
this.startPositionY = startPositionY;
-
-
// Set the timeline to attach the phrase object to
-
mTimeLine = pTimeLine;
-
-
// Set the depth for the object
-
depth = mTimeLine.getNextHighestDepth();
-
-
// Create a movieclip for the object
-
container = mTimeLine.createEmptyMovieClip("container"+depth,depth);
-
-
// Add the text to the phrase object
-
createPhraseObject();
-
-
// Update
-
updatePhraseNumber();
-
}
-
function createPhraseObject() {
-
-
// Create textfield
-
textObject = container.createTextField("phrase_"+count+"_txt",count, 100, 100, 300, 100);
-
textObject.color = 0xFF0000;
-
textObject.text = this.phrase;
-
textObject._x = 0;
-
textObject._y = startPositionY;
-
-
// Return a reference
-
return container;
-
}
-
public function setY(newY:Number) {
-
-
this._y = newY;
-
-
}
-
private static function updatePhraseNumber() {
-
-
trace("Updating count: "+count);
-
count++;
-
return count;
-
-
}
-
-
}
-
Hope someone can point me in the right direction, thanks.
chromis
1 2619
Ok so perhaps my question was a bit complicated, i've simplified my goal and gone for one class with two functions one for adding phrases and one for organising them on the stage.
I've having trouble organising them now, what i'm trying to do is loop throuh the array of phrases and position them vertically below each other each time a new phrase is added, i can't seem to get the code quite right though could somone point out where i'm going wrong please?
PhraseCarousel. as:
Thanks.
Chromis
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Carolyn Gill |
last post by:
It was working fine on the test server. loaded it onto iis6 server after
installing php and got everything working (after redirecting it to the
correct directory) except for 1 annoying error that I don't understand.
Any help would be appreciated - the sooner the better so I can get some
sleep tonight!
Undying gratitude to anyone willing to help a php beginner!
here's the page with the error http://www.ioworldwide.com/ and...
|
by: jonathanthio |
last post by:
How do I create a page rotator? Is there a script for that?
Also is there a way to do a page rotator that's not random but based on
cookies.
For example, if a new person see my website, it'll go to my website. If
he visits my website a second time, it'll go to a traffic exchange
website.
Can that be done?
|
by: Mark A. Sam |
last post by:
Hello,
Does anyone know of a third party ad rotator that automatically changes the
images? It seems like the ad rotator in that comes with Visual Web
Developer changes images only when the pages is refreshes. Is that correct?
Thank you and God Bless,
Mark A. Sam
|
by: dimkar |
last post by:
I finished my first design in flsh 8 using autoscript. It is a carousel gallery of 14 images rotating around.
I am very new to this area but i hava a knowledge on programming language.
What i want is when an image comes in the center of the monitor to scale
automatically, stay at the max scale for around 2 secs then scale back to its original size.
when an image is in the proccess of scaling, the other images should stop and wait until the...
|
by: raknin |
last post by:
Hi
I have a carousel script. I want to load the carousel with a new set of pictures every time I press a button. The problem that I have that the script append the new pictures to the olds one and the next and previous buttons are added again and again. Please help meto solve the problem. The full html and javascript are attached for your conviniet.
HTML
-------
<HTML>
<HEAD>
<META http-equiv="Content-Language" content="en-us">
| |
by: empiresolutions |
last post by:
I'm trying to slightly alter the script found here, http://www.adrianhodge.com/web-design/mootools-horizontal-div-slider-121/.
What i want to do is make the carousel work on a Next/Previous feature versus a 1, 2, 3 method. I tried to do it myself but found i was was just going in circles and nothing was working. Any help is appreciated. I have listed below the only parts that should matter.
Javascript
<script language="Javascript">
<!--...
|
by: zenzero |
last post by:
I was wondering if anyone knows any Carousel script that can display photos, which one can slide in between using a slider? I.e similar to Mooflow, but I want to display only one photo at the time and don't want the zooming effect when sliding. I was hoping there might also be something like this that can also display html content?
Thanks in advance!
|
by: jrsjrs |
last post by:
I have been trying to adapt the photo carousel script located at --
http://www.dynamicdrive.com/dynamicindex14/carousel.htm
to open a new page in another frame located directly below the clickable
carousel frame photos. I know that the basic script to do this is as in --
<a href="http://www.example.org/" target="bottom">Click</a>
but I cannot figure out how to modify the script from
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |