Resizing Flash Stage in HTML

Recently I came across a situation where I needed to resize the stage of the flash file from within HTML. I came up with a very simple way of doing it and decided to share it with you all.

The tutorial should be very easy to follow for people with even least knowledge of Flash, ActionScript, HTML, CSS and JavaScript. I will try to be as detailed as possible in writing this tutorial.


I am going to use Flash 8.0, ActionScript 2.0, Javascript and HTML/CSS in this tutorial. Lets get started!

We are going to start by creating a new Flash file.

Set the dimensions of the Flash file to 170px x 170px.

Create 2 movie clips


Name: mcA, Linkage Name: mc_A, Movie Clip Dimension: 170px x 170px.

Name: mcB, Linkage Name: mc_B, Movie Clip Dimension: 400px x 300px.

I am going to keep both the movie clips in the library and attach them dynamicaly using attachMovie class. You can put the movie clips on the timeline if you need to.

Action Script:
//attach the mc_B to stage and give it an instance name movieClipB…
attachMovie(“mc_A”, “movieClipA”, _root.getNextHighestDepth());


We are going to use the External Interface class to allow action script in flash to communicate with the Javascript in HTML. Lets go ahead and import the External Interface class in flash.

Action Script:
import flash.external.ExternalInterface;

Now lets create a function to remove the movieClipA from the stage and attach mc_B when the movieClipA is clicked.

Action Script:
function enableButtonA(){
//when movieClipA is clicked and released…
movieClipA.onRelease = function (){
//call the function receiveFromFlash in JavaScript and pass it the parameter css/css2.css…
ExternalInterface.call(“receiveFromFlash”, “css/css2.css”);
//attach the mc_B to stage and give it an instance name movieClipB…
attachMovie(“mc_B”, “movieClipB”, _root.getNextHighestDepth());
//call the function enableButtonB in flash…
enableButtonB();
//remove the previously attached movieClipA from the stage…
removeMovieClip(“movieClipA”);
}
}
//call the function enableButtonA in flash…
enableButtonA();


Now lets create another similar piece of code for when the movieClip B is clicked.

Action Script:
function enableButtonB(){
//when movieClipB is clicked and released…
movieClipB.onRelease = function (){
//call the function receiveFromFlash in JavaScript and pass it the parameter css/css1.css…
ExternalInterface.call(“receiveFromFlash”, “css/css2.css”);
//attach the mc_A to stage and give it an instance name movieClipA…
attachMovie(“mc_A”, “movieClipA”, _root.getNextHighestDepth());
//call the function enableButtonA in flash…
enableButtonA();
//remove the previously attached movieClipB from the stage…
removeMovieClip(“movieClipB”);
}
}

Alright! we are done with the actionscript portion for this project. Now publish and create the SWF and HTML files.

Now lets create the CSS files.

CSS
.flashDim{
width:170px;
height:170px;
}
Save the css files as css1.css

CSS
.flashDim{
width:400px;
height:300px;
}
Save this css file as css2.ss


Create a new folder called ‘css’and move the 2 css files inside the folder.

Lets open up the HTML file in notepad, or any other text editor and make some changes to it.
We are going to link the css1.css file inside the HTML and create a javascript function to switch between the two css files we created. This is the same function we are going to call from within flash using the ActionScript External Interface class.


Code explaind:

When we click on the movie clip in flash, the action script uses the external interface class to communicate with javascript inside HTML. The javascript function is called and a parameter is passed to the function. The javascript changes the css file that increases (and decreases) the dimension of the div.

I hope this tutorial is going to be helpful.


Tagged with:
 

Oracle of Delphi


The Oracle of Delphi were a priestess supposedly delivered messages from Apollo to those who sought advice; the messages were usually obscure or ambiguous.

People came all over Greece and beyond to have their questions about the future answered by the Pythia, the priestess of Apollo. Her answer could determine the course of everything from when a farmer planted his seedlings, to when an empire declared war.


 

I am a Muslim


A Jew can grow his beard in order to practice his faith but when a Muslim does the same, he is an extremist and terrorist!

A nun can be covered from head to toe in order to devote herself to God, but when a daughter of Muslim-Ummah does the same, she is oppressed.

When a western woman stays at home to look after her house and kids she is respected by the entire society because of sacrificing her life to her house, but when a Muslim woman does so by her will, she needs to be liberated.


Any girl can go to university wearing what she wills and have her rights and freedom, but when a Muslim Girl wears Hijab, they prevent her from entering the university.

When a child dedicates himself to a subject, he has potential and talent, but when he dedicates himself to Islam he is hopeless.

When a Jew kills someone, religion is not mentioned, but when a Muslim is charged with a crime, it is Islam that goes to trial.

When someone sacrifices himself to keep others alive, he is noble and everyone respects him, but when a Palestinian does that to save his son from being killed, his brother’s arm being broken, his mother being raped, his home being destroyed, and his mosque being violated, he gets the title of ‘terrorist’.

When someone drives a perfect car in an improper manner, no one blames the car, but when any Muslim makes a mistake or treats people in a bad manner – people say “Islam is the reason”!

Without giving a glance at Islamic laws, people believe what the newspapers say, but question what the Holy Quran says.

I am a Muslim, kill me and call it “Collateral Damage” imprison me and call it “Security Measure” exile me in masses and call it “New Middle East” rob my resources, invade my land, alter my leadership and call it “Democracy”


 

What is Piety?


Definition #1: “Piety is doing as I am doing.”
Definition #2: “Piety is which is dear to the gods.”
Definition #3: “What all the gods hate is impious, and what they love pious and holy.”
Definition #4: “Piety or holiness, Socrates, appears to me to be that part of justice which attends to the gods.”
Definition #5: “Piety is learning how to please the gods in word and deed, by prayers and sacrifices.”
Definition #6: “Piety is that part of justice which attends to the gods, and there is the other part of justice which attends to men.”
Definition #7: “Piety is what is dear to the gods.”


In spiritual terminology, piety is a virtue. While different people may understand its meaning differently, it is generally used to refer to religious devotion or to spirituality, or often a combination of both. A common element in most conception of piety is humility.


 

The Phaedo

The Phaedo is one of Plato’s great masterpieces, combining difficult and profound philosophy with a lively and engaging narrative. As a result, it is one of the rare philosophical classics that are easily readable and rewarding of rewarding careful study.

The Phaedo begins when Echecrates asks Phaedo to tell him about Socrates’ death, and Phaedo warmly welcomes the chance to remember his friend Socrates in the final hours of his life. He says that it was an astonishing experience because although he was witnessing the death of a dear friend, he had no pity because of the way in which Socrates bravely and happily faced it, unafraid of the unknown.


In the days prior to Socrates’ death, Phaedo and other friends frequently visited Socrates in jail. Each time they discuss something new and interesting, including Socrates’ thoughts on why it is wrong to kill one’s self. Socrates thinks that it shows disrespect to the gods when one chooses to commit suicide because men are possessions of the gods and the gods are right to be angry if one of their possessions kills himself.

Cebes thinks that what Socrates has said doesn’t make sense because the wise should always want to be with better people than him so he can learn from them, as philosophers want to do. If one dies, one will not be with wiser people anymore and so the wise should resent death while the foolish should rejoice at it Socrates then tries to defend his argument by showing Cebes and Simmias that if death is the separation of the soul from the body, the philosopher by being a philosopher seeks to have himself separated as much as possible from his body because the body inhibits the mind. And therefore, the philosopher practices death everyday in his life. So the philosopher, as an example of “the wise” would not resent death as Cebes originally thought.


The men then take up discussion on what exactly death is, and Socrates tells a lot of qualities of the soul in the opinion of Plato. He says that the soul is capable of reasoning and thought, and that those capacities alone can grasp relevant objects, so he believes that no thought at all can be reached through the senses of the body which means that he thought knowledge could be attained completely independent of experience.

The Phaedo ends with Socrates saying that the soul is immortal; it requires our care in life by being good so that we may fare well in death. Obviously philosophers were considered by Plato to have the best souls because they spent their lives in search of knowledge and therefore they can make better choices and have a better chance of choosing a good life, all because of the knowledge that they acquired and the way in which they lived their lives.

Finally, Socrates drinks the hemlock and his friends become quite upset. Phaedo says that he felt ashamed for crying when Socrates was so dignified, and then the great philosopher and man took his last breath of air before dying. Those who knew him held him best held him in such high regard at the very end of his life, and at perhaps the most poignant time in his life-his death.


 

Parmenides

Parmenides was born in Greek colony of Elea in 6th century B.C. He was a descended from a wealthy family. He is reported to have been a student of Xenophanes, and the founder of the School of Elea. It is also known that he had written the laws of the city of Elea. According to Milič Čapek, Parmenides is one of the most significant of Pre-Socratic philosophers. His only known work, conventionally titled ‘On Nature’ is a poem which has only survived in a fragmentary form. Reportedly, the original text had 3,000 lines. Today, approximately only 150 lines of the poem remain.

In his poem, Parmenides describes that reality is one, change is impossible and existence is timeless. Parmenides claimed that truth cannot be recognized by the sensory perception. And can only be understood with pure reason. In his poem he explains the world of appearances, and that it is false and deceitful. These thoughts greatly influenced Plato.


The common understanding of Parmenides’ work is that he argued that every-day perception of reality is mistaken. And in real the world is ‘One Being’. It is undeniable that Parmenides inspired Plato, and through him the rest of the western philosophy. He is often referred to as the grandfather of philosophy. In ‘The Sophist” Plato refers to the work of “our father Parmenides” as something to be taken very seriously and treated with respect.

Socrates says in Theaetetus that Parmenides, along with other philosophers denied that everything is change and motion. Parmenides argued that “movement was impossible because it requires moving into “the void”, and Parmenides identified “the void” with nothing, and therefore (by definition) it does not exist.” [?]


 

Zeno of Elea

Zeno was a Greek Philosopher and mathematician of the southern Italy. He was a member of the School of Elea founded by Parmenides. He is well known for his Paradoxes which mathematicians’ view of reality for centuries. According to Diogenes Laertius, Aristotle called him the inventor of dialectics.

Zeno accompanied his teacher on a trip to Athens in 449 B.C. There he met a young Socrates and made enough of an impression to be included as a character in one of Plato’s books Parmenides. On his return to Elea he became active in politics and eventually was arrested for taking part in a plot against the city’s tyrant Nearchus. For his role in the conspiracy, he was tortured to death.


The four famous paradoxes of Zeno are the Dichotomy, Achilles, The Arrow and The Stadium. The most famous of the paradoxes, Achilles and the tortoise, is attributed to Parmenides himself. It is meant to show that motion is impossible. In a race where a tortoise is given a head start on Achilles, Achilles can never overtake the tortoise. He must first reach the place from which the tortoise started. By that time the tortoise will have got some way ahead. Achilles must then make up that and again the tortoise will be ahead. Zeno’s four most discussed paradoxes have been resolved in terms of differential calculus by Bertrand Russell, who claimed that Zeno should not be dismissed as a mere inventor of ingenious puzzles. Although all four arguments sound illogical and confusing, they are not simple to explain. Aristotle discarded them as fallacies without really showing why.

According to Plato, Zeno had already written a book before his trip to Athens. Unfortunately no work by Zeno has survived. But there is very little evidence that Zeno wrote more than one book.


 

According to Princeton University, virtue is the quality of doing what is right and avoiding what is wrong. Virtue can be defined as many things. A virtue is a standard by which we judge and standardize our behaviors and characters based on moral excellence. Our virtues or standards are what make each of us different, because we all have different beliefs of what is good and bad.


Virtue is the key to a meaningful and happy life. According to ancient philosophers, Socrates and Aristotle, developing virtue is vital in order to lead a successful, fulfilling life. Although both men differ in interpretations of a “good life,” they both agree that the supreme life is one of virtuous meaning.

Can virtue be taught? The answer to the question is anything but simple. The question is examined in detail throughout Plato’s dialogue called Meno. According to Plato, men cannot be taught anything but knowledge. Therefore, virtue must be a kind of knowledge in order to be taught. This leads to a new question. Is virtue knowledge?


Tagged with: