[F8] Geturl Blocks Me
Hello i am building a website for an hotel and i want to link to a weather page of the area. However the geturl is being blocked... is there a way to bypass this? Thanks!
FlashKit > Flash Help > Flash ActionScript
Posted on: 11-23-2007, 01:42 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
MySpace Blocks All GetURL Commands?
Hello Kirupa forum users.
I've created a really cool streaming mp3 player for my personal myspace page (www.myspace.com/thePhallex), which I am hosting from my personal site.
In the past some a$shole has just copied-and-pasted my embed code to show MY mp3 player on HIS personal myspace page, without my permission, increasing my bandwidth consumption. That buttwipe.
Anyway, to prevent people from thinking that anyone besides me created MY work, I've put in a line of text at the bottom of my flash movie, that says how I created it ("created by thePhallex").
I'm trying to use a button to link this line of text back to MY page, in case another dumba$s decides to host my mp3 player again.
It seems as though somehow MySpace has blocked all "getURL" requests from ever happening, via their server-side code (i'm guessing for security reasons). BUT, they host a TON of ads that are flash-based, and when you click on them, it opens up their link.
Has anyone found a work-around or fix to MySpace's dumb getURL blocking??
OR
Has anyone found a way to hide your HTML source in MySpace?
Help please!
As Blocks
Hi!
I have a code that sets the frameposition for 2 movieclips. However if you click a button and the _currentframe does not match those in the code the 2 mc's totally block...
Code:
product.onRelease = function(){
_root.beginScherm.voorbeeld.companyMC.onEnterFrame = function(){
if(this._currentframe == 19){
_root.beginScherm.voorbeeld.companyMC.gotoAndPlay(20);
}
if(this._currentframe == 36){
_root.beginScherm.voorbeeld.productMC.gotoAndPlay(2);
_root.beginScherm.voorbeeld.companyMC.gotoAndStop(1);
delete this.onEnterFrame
}
}
}
company.onRelease = function(){
_root.beginScherm.voorbeeld.productMC.onEnterFrame = function(){
if(this._currentframe == 50){
_root.beginScherm.voorbeeld.productMC.gotoAndPlay(51);
}
if(this._currentframe == 87){
_root.beginScherm.voorbeeld.companyMC.gotoAndPlay(2);
_root.beginScherm.voorbeeld.productMC.gotoAndStop(1);
delete this.onEnterFrame
}
}
}
Is there something i can add to this code to ignore clicks on the buttons if it does not meet the demands in the code? For example by blocking all buttons if not on the frames described in the code?
Lego Blocks
I am currently developing a website for kids which enables them to build simple structures out of lego. I can drag and drop them so that flash knows if they are dropped over another block, but I want them to snap into place. Can anyone think of a functional way of achieving this.
Cheers
matt
Moving Blocks
Id like to know how to create this fairly simple effect
http://www.monitorpop.com/
use the menu in the upper left.
I can do it to a degree but cant get the seemless transitions
thanks
n
Red Blocks In Swish
Hello,
I am new to Swish and have 2.0. Whenever I import multiple images or text to work with I can only see the object I am currently working on and all the rest of the stuff goes red. I cannot see everything until I preview the scene. Is there anyway to see all the stuff while working on one object without previewing the whole scene?
Thanks
Duplicating Blocks
hello there
i really need some help. i am trying to create an interface that will allow the end user to design a carpark layout by dragging spaces onto a surface area. the 'spaces' are represented by movie clips that will duplicate when dragged away, leaving the user free to add more spaces by simply dragging more down to the surface area. each space needs to also be removable without duplication once it is on the parking area.
so far i am using this script, applied to the space movieclip
onClipEvent (load) {
this.origX = this._x;
this.origY = this._y;
}
onClipEvent (mouseDown) {this.startdrag()
spacecount = spacecount + 1}
onClipEvent (mouseDown) {
this._parent.space.duplicateMovieClip ( "space", + spacecount, spacecount)
}
onClipEvent (mouseUp) {
if (this.hitTest(this._parent.ground)){this.stopDrag ()}
}
but this script has a alot of strange buggy problems
please help me!!!
cheers
Help Blocks On Pong
i have made a pong like game but the ball when it hits the paddel dissapears behind the paddel before it is eventually hit how do i solve this
Following Mouse X&y By Blocks
Any help here is very gratefully received!
I am writing a game and want the blocks I have created to follow my mouse cursor in 'blocks'.
The effect should be something like in tetris: when the block is moved left or right it moves in units.
Say the unit size is 56, I have attached the following code to the moveable mc with no luck:
onClipEvent(mouseMove)
{
roundedX= Math.round(_root._mousex)
roundedY= Math.round(_root._mousey)
if (roundedX % 56 == 0 ) {this._x = roundedX}
if (roundedY % 56 == 0 ) {this._y = roundedY}
}
Can anyone see anything wrong with this approach? I get no sensical movement from the mc!
Thanks a ton for any help!
Pushing Blocks
hi
im working on a overhead view game where you control the player.
ok so i found this code
Code:
onClipEvent (load) {
posy = _x;
movey = 120;
// move back 120 px
maxy = posy-movey;
// max y movemen
activate = true;
// if move is completed stop checking for hitTests
}
onClipEvent (enterFrame) {
if (activate) {
if (this.hitTest(_root.hero._x-12, _root.hero._y, true) and Key.isDown(Key.LEFT)) {
if (_x<maxy) {
_x = maxy;
activate = false;
}
_x--;
_root.hero.speed = 1;
// slow down hero
}
}
// end activate
}
this works great, but i can only push the box to the left. any idea on how i could push it in all 4 directions, and have it stop once it hits my movieclip??
THANKS!
game
Randomized Blocks
Hi All,
How can I create a grid of squares (or any specific pattern) where the individual squares in the grid would randomly flash on and off? I hope the question isn't too vague.
Can someone please help me out and explain what I need to do?
Thanks
Dave
Stacking Blocks
I want to have a bunch of blocks fall from the sky like rain then stack up when they hit the floor of the stage. anyone know how I would go about this?
I'm going to start by creating the blocks and then jamming them into an array from there i can control their falling speed but I don't know where to start as far as the collision detection. I was initially thinking of using a hit test to stop the blocks when they hit each other but quickly realized that if they hit each other mid flight they would stop where they were
Randomized Blocks
Hi All,
How can I create a grid of squares (or any specific pattern) where the individual squares in the grid would randomly flash on and off? I hope the question isn't too vague.
Can someone please help me out and explain what I need to do?
Thanks
Dave
Dragable Blocks That Tell You There Position
I want to have 3 blocks on stage and be able to drag them around the stage and rotate them in 90 degree increments. Also i would like to get some feedback of the mouse cursor. Iam working in a strange measurment which is inches-feet-sixteenths in increments of:
004= 1/4 inch
So 3 inches is written as 300! 8 feet is written as 80000!
if you have a wall thats 15' 8" it would be written 15800 is your head spinning yet! So i would like to have a stage of 12 inches by 8 inches and be able to output this type of measurement system.
Any ideas?
thanks
IE Blocks Flash Movie
I know, I know IE sucks, I use Firefox, but most people don't so I am wondering if there is anything I can do for the less wise folks out there. IE blocks the Flash movie any time it loads. Is there anything I can do so it won't? I am making the movie in Flash MX 2004, and I believe Flashplayer 7 I publish for.
Slidding Blocks With No Overlap
Hi Iv'e searched under Hittest, Collission, Overlapping and Dragging but I can't find anything that I can (or know how to) modify to make a slidding block without overlapping other blocks.
I have some blocks with letters on them and I want to be able to slide them up, down and sideways in order to make a word, But I don't want them to overlap as I'm sliding them.
I have a drag action on all blocks but right now I can drag them all over the place (which I don't want)
I have attached the fla file If anyone can help me get started with one of the blocks.
Thanks
Slidding Blocks With No Overlap
Hi I've searched under Hittest, Collission, Overlapping and Dragging but I can't find anything that I can (or know how to) modify to make a slidding block without overlapping other blocks.
I have some blocks with letters on them and I want to be able to slide them up, down and sideways in order to make a word, But I don't want them to overlap as I'm sliding them.
I have a drag action on all blocks but right now I can drag them all over the place (which I don't want)
I'M using Flash 8 and I have attached the fla file If anyone can help me get started with one of the blocks.
Thanks
MIE Now Blocks My Flash Elements
Is this a new function of the worrisome pop-up blocker?
I use flash elements and menus in most of the websites I design. Now when I load these sites using Explorer, the flash swf's don't respond right away. When you roll over them, you see a gray box appear around them. You click once to activate/approve the flash. Then you can use the swf like normal.
I'd like to find away around this extra click step. It's annoying and confusing to the average visitor.
I'm using Flash MX, if that makes any difference.
Swfobject - Ie Blocks Content
Damn I hate ie. Here is my problem. I just launched a site, and i am using swfobject 1.5 . It worked great in firefox, ie, opera, and ns on my workstation. When I viewed it on my laptop, I only got my alternate content in ie. I just reinstalled windows on my laptop, and the settings for ie are default. It's the newest version of ie. Is anyone else having this problem?
Red Blocks Have Replaced My Images
Hi,
I'm making a short animated film in flash and have just added one final element (an imported PNG seqence from after effects) whcih seems to have made other images (mostly gifs) turn into solid red blocks. I've had a bit of a search online and it sounds like it's a memory issue (Flash struggled a bit when I imported all of the PNGs), one solution suggested increasing the memory allocated to flash in the finders 'get info' section, but I don't seem to be able to change this (I'm usin a MacBook Pro, and Flash8 Professional, Student Edition).
Does anyone know how I can get rid of these red blocks or if there's some way to increase memory allocated to Flash.
I saved the fla. before I realised things had gone wrong, and now I'm worried my gifs have been lost.
Thanks for your time.
PLEASE HELP, DESPERATE - New Firefox Blocks All Pop-ups
I don't know what to do... My portfolio is based on being able to open a pop-up window...
the new Firefox 2.0.0.6 no longer asks you if you "want to allow pop up windows from..." It just blocks it all together.
What do I do? I'm at wits end, I need to start looking for work, and my portfolio needs to be working for that....
Firewall Blocks Loadvars
Is it possible for a companies firewall to block Loadvars? I've got the following little script to test it.
Code:
stop();
mySendVars = new LoadVars();
myLoadVars = new LoadVars();
mySendVars.naam = "Rene";
mySendVars.email = "test@gmail.com";
mySendVars.bericht = "bla bla";
mySendVars.sendAndLoad("http://www.testme.nl/testmail.php", myLoadVars);
trace (myLoadvars.naam);
testmail.php is just a simple "echo" to load a variable back.
But when testing the fla, nothing happens, not even an error message. And the trace traces "undefined".
My bigger script at home works perfectly, so I thought, perhaps the firewall at the office which blocks this?
I've also put the published files online, but then it doesn't work at the office either.
If a firewall bloks Loadvars, is it possible to check for this?
[F8] Help Create Menu With 3 Blocks
I try to create a simple menu wich contains 3 blocks. Where mouse is over on block it partially displace two another. I propose simple algorithm but it quitly works only when we have 2 blocks. Please help me modified my algorithm or propose another solvation of my task. Sourcecode in attachment.
Help Condensing Nested If Blocks
I am writing a particle physics engine, and I have a fairly verbose section of code to calculate relative masses when there are massless particles involved. It seems like it should be reducible down to some concise math and fewer if statements. Can you suggest any ways to do this? I'd appreciate the help.
m -> a mass
w -> an inverse mass (1/m) used by the physics engine
when w = 0, the particle has infinite mass and does not move
when w > 0, the particle has some normal amount of mass, unless...
unless m = 0, in which case the particle has no mass
so w values for the other particles must be adjusted to compensate
Here's the relevant code:
Code:
// calculate relative node weights
var w0:Number = n0.w;// node 0 weight
var w1:Number = n1.w;// node 1 weight
var w2:Number = n2.w;// node 2 weight
// check whether nodes are weightless
if ( n0.m )
{
if ( n1.m )
{
if ( n2.m )
{
// keep weights as they are
}
else
{
// only node 2 should move
w0 = w1 = 0;
w2 = 1;
}
}
else
{
if ( n2.m )
{
// only node 1 should move
w0 = w2 = 0;
w1 = 1;
}
else
{
// node 1 and node 2 should move
w0 = 0;
w1 = w2 = 1;
}
}
}
else
{
if ( n1.m )
{
if ( n2.m )
{
// only node 0 should move
w1 = w2 = 0;
w0 = 1;
}
else
{
// node 0 and node 2 should move
w1 = 0;
w0 = w2 = 1;
}
}
else
{
if ( n2.m )
{
// node 0 and node 1 should move
w2 = 0;
w0 = w1 = 1;
}
else
{
// all nodes are equal
w0 = w1 = w2 = 1;
}
}
}
Thanks in advance!
Is It Possible To Nest Try...catch Blocks?
Hi,
I have a try...catch block like this:
ActionScript Code:
try{
operation1();
operation2();
operation3();
operation4();
}catch(myError: Error){
if(myError.name = "MyErrorName"){
trace("error occured");
}
}
nevertheless I would like to catch a possible error in a specific operation, something like:
ActionScript Code:
try{
operation1();
try{
operation2();
}catch (myError: Error){
trace("an error occured on operation2");
}
operation3();
operation4();
}catch(myError: Error){
if(myError.name = "MyErrorName"){
trace("myError occured");
}
}
Nevertheless the flash compiler doesn't seem to like this nesting.
Is there a way to nest try...catch blocks, or will I have to split those operation calls in several try...catch blocks?
Win XP New Information Bar Blocks Flash... ?
Hi guys!
I just installed the new Windows XP Service Pack 2 on my machine
and it is such a pain in the neck!
Any of the websites that I visit now with flash or any active x content
are blocked by this ANNOYING info bar at the top that you have to click
to disable every freaking time you load the page!
Does anyone know what is up with this?
The security controls for IE cannot be lowered under MEDIUM ...won't let you!
And thus ... you can't do anything ! UGH! Anyone know how to deal with this?
I mean, I guess we all want to keep the Service Pack, but not with these
annoying side effects!
Btw, it also changes your Network Connections panel look...
It makes it "easier" ... I liked it better before. More control.
Now it looks ... Appleish. *gasps*
Oh, and you better have a firewall, an antivirus and automatic updates
all installed and enabled, otherwise it tells you to get them turned on in
the system bar...
AAAAAAAAAAAAAAAAAAH!
HELP!!!
Fade The Rest Of The Blocks
Hi Guys for my previous post I got the answer right away. Thanks to all who helped.
This is a question related to mouse hover in flash.
If you go to http://www.drawingart.org/#/our_projects/websites
You see a few thumbnails on the page. When you do mouse over on one the rest of it fades out. Is this some scripting used?
Please help!
Dynamic Blocks From Class
This may be a simple request but I am just starting to wrap my head around the whole class idea.
I am attempting to create a simple class that will allow me to load dynamic content into a series of movie-clips, all generated based on an XML file. I want to be sure I am moving down the right path here so I thought I would ask.
So at present I have an XML file which I parse and then loop through to create new instances of a class I am calling speaker. I have a movie-clip in my library that I have associated with an .as file. I loop through the XML list, all of the clips get loaded onto the stage properly.
What I am attempting to do is adjust the content of those clips (load images, adjust dynamic text fields) Should I be writing those functions into the .as file? In my mind it seems like the most efficient way to do all of this would be to pass the new clip an XML node and the content gets populated based on functions that accept XML data inside the class. Honestly though, I would be happy if I could get a simple trace function to work from it. Here is what I am working with:
--------
speaker_class.as
--------
package {
import flash.display.*;
import flash.events.*;
public class speaker extends MovieClip {
public function speaker() {
this.addEventListener(Event.ADDED_TO_STAGE, trace_content, false, 0, true);
}
function trace_content(e:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, trace_content);
trace("speaker loaded");
//load_images
//adjust dynamic text
}
}
}
----------
timeline actions
----------
function parse_xml(xml_data:XML):void {
var speaker_list:XMLList = xml_data.speaker.speaker_image;
for (var i:int = 0; i < speaker_list.length(); i++){
var rows:int = 3;
var speaker_clip:XML = speaker_list[i];
var new_speaker:speaker = new speaker();
new_speaker.x = ((new_speaker.width+50) * int(i / rows))+25;
new_speaker.y = ((new_speaker.height+15) * (i % rows)) + 25;
new_speaker.name = speaker_clip;
addChild(new_speaker);
}
}
Win XP New Information Bar Blocks Flash... ?
Hi guys!
I just installed the new Windows XP Service Pack 2 on my machine
and it is such a pain in the neck!
Any of the websites that I visit now with flash or any active x content
are blocked by this ANNOYING info bar at the top that you have to click
to disable every freaking time you load the page!
Does anyone know what is up with this?
The security controls for IE cannot be lowered under MEDIUM ...won't let you!
And thus ... you can't do anything ! UGH! Anyone know how to deal with this?
I mean, I guess we all want to keep the Service Pack, but not with these
annoying side effects!
Btw, it also changes your Network Connections panel look...
It makes it "easier" ... I liked it better before. More control.
Now it looks ... Appleish. *gasps*
Oh, and you better have a firewall, an antivirus and automatic updates
all installed and enabled, otherwise it tells you to get them turned on in
the system bar...
AAAAAAAAAAAAAAAAAAH!
HELP!!!
Moving Blocks On Mouse Over
I would like have a small square solid block and when the mouse is moved over it, it spreads into several more blocks
to make a T shape. Its a bit like the one on the Macromedia
page http://www.macromedia.com/software/flash/about/.
Can anyone help as to how it is done.
Thanks
George
Large Blocks Of Text
What's the best way to deal with large bodies of text? Should I just type it into flash, make it a symbol and go from there? Is there a more dynamic method?
Animating Large Blocks Smoothly
Hi, please help,
I am trying to animate a large solid colour panel (just a bog standard motion tween so it moves from one side to another). It is at 20 fps. Whatever I do, the animation looks very jerky.
It is moving on a layer above quite a complicated graphic - could this be the reason? I have seen other Flash sites that animate large blocks very smoothly.
Thanks in advance...
Scrollers And Large Text Blocks
I have been playing with different code examples for scrolling objects/text. I have found that even in the best scrollers, scrolling a large block of text (even a couple of large paragraphs) seems to be a real drag. My fav scroller example is one that I found here in the tutorials made by Jake (Scrollin-Jake_Gel-687). I tested this with a line of 30+ 2-3KB jpg thumbnails and its as smooth as gold, but with a block of text a page long, it s#cks. Any suggestions on smoothing things out with text? Or am I just missing somthing simple when it comes to optimising the text?
Html Signature Blocks In Flash
I am attempting to place an html code into my all flash site. The game i play has a tracker that supplies a signature block with realtime statistics. I cannot seem to place it into my site. The html that I am trying to use is as follows:
<a target="_blank" href="http://aaotracker.4players.de/usertracker.php?userid=13389"><img border="0" src="http://aaotracker.4players.de/trackersig.php?userid=13389"></a>
a target="_blank" href="http://aaotracker.4players.de/usertracker.php?userid=13389">img border="0" src="http://aaotracker.4players.de/trackersig.php?userid=13389">/a>
(Which Ironically shows up on this forumm I will remove the html brackets so you can see the proper code)
It provides a small block of text that changes dependent on my play. I am trying to place other members signature blocks on my site but cannot seem to do it. Any information would be greatly appreciated. I have tried using photoshop to embed html into the file that way and then importing it into flash, but flash doesnt recognize it. I have only been using flash and other programs for a little over a month so I am kinda new and ignorant, so if you are able to help I would appreciate as laymen as you can get. Thanks. The site is http://www.enterthecore.com and I was going to place them into the roster section.
Service Pack 2 Blocks Flash?
I don't know if I missed the discussion... I'm really surprised it isn't pasted all over the site... but I just upgraded to the new service pack 2 for internet explorer and discovered that it blocks all flash content?
Have I got this right? Macromedia help desk told me how to fix it in the options but can we really expect naive users to do this?
I know I found it really frustrating that each time a page appeared I needed to go to the information bar and tell it the flash content was OK.
I may have got this all wrong, I'd love to hear if there's a forum on this issue or if it's just particular to my system. If it is a real issue I'm surprised there wasn't something on the main page.
I've been working with flash for 4 years, but personally it makes me question using flash for future projects just because I won't be able to sell it to clients.
"We've got this great web tool, but not only do you need to download a plugin to make it work but ALSO if you go up to the menubar under tools and internet options... and security controls and then..."
If there is an easy solution I'd love to hear it!
Startdrag Blocks Button Rollout
I am having a problem with the following...
I have this script attached to a button which starts a MC dragging on rollOver and then is supposed to release the MC on rollOut.
on (rollOver) {
startDrag(sliderPos,true,0,0,400,0);
sliderPos.gotoAndStop("show");
}
on (rollOut, dragOut) {
stopDrag();
sliderPos.gotoAndStop("hide");
}
The rollover starts the drag, but once the MC (sliderPos) is dragging the rollout is blocked and the clip won't go to the "hide" frame. If I comment the startDrag() then it works fine.
Any workarounds?
Stacking Blocks, Collision Detection?
hello, basicaly i want to create a stacking block effect. this is what i've got so far Blocks.fla
i'm not the most advanced or skilled at writing actionscript, so am looking for a simple way of adding somekind of collision detection so the blocks can sit on top of each other. is collision detection the easyest way to do this? or can anybody point me in the direction of a good tutorial to help me get the effect i'm after?
cheers
[F8] Halo Behind Graphics And Text Blocks
I've been working with flash for a while and I keep noticing that there is a "halo" behind text blocks and grouped graphics that changes the color of the background in that area. Is this something I can control or keep from happening? I find myself designing with only a white background to avoid this. Any other ideas?
[F8] Making Random Blocks Move Up
Hi there, (first time posting hoping to have a nice time from now on here )
Basicly my problem is that I want to make a game, at the moment graphics are not important I can make them later but I need help in coding for it.
1) How would I have 1x1blocks randomly of 6 diffent colors moving up the playing feild,
They all come in at the same time in lines of around 10
2) When three or more colors match they dissapear and the ones above the dissappearing blocks move down
3) The aim is to keep the block from reaching the top. If they do you die
Thanks for any help
Blocks Transition In JpgRotator Question
i am very intrigued at the BLOCKS transition in jpgRotator. Do you guys know any tutorial that would teach me how to do that transition, i dont want to use jpgrotator by the way because i want my images to be in the SWF file in itself. i am using flash mx 2004 with AS 2.0.
i saw another using the same actionscripting principles here. Instead of blocks it utilized circles.
Two Scopes, Two Blocks, Yet Variable Conflict?
I get 1151: A conflict exists with definition [varName] in namespace internal.
Simple example breakdown:
Code:
var toggle:Boolean = true;
if (toggle == true){
var myState:int = 1;
trace(myState);
}
else if (toggle == false){
var myState:int = 2;
trace(myState);
}
Shouldn't I be allowed to create the variable in both scopes, especially since they are separate scopes, and only one will fire, and I want the variable to not be referenced as soon as either block is done.
I thought whenever you used statement blocks, whether in a for loop, an if statement, or even as just curly braces, they were indeed their own scope?
even simpler example, that generates a warning, and I felt it should not.
Code:
{
var myName="jimmi";
trace(myName);
}
{
var myName="EvilJimmi";
trace(myName);
}
I know this isnt the best practice, this is just to show smallest concept. Ideas? Do i not understand how scope is handled when it comes to curly braces?
yet a third example, that behaves not how i expected. I thought if you declared a variable inside a block, you could not access it after the block exits?
Code:
for (var i:Number = 0; i < 10; i++){
var j:Number = i;
trace(j);
}
trace(j);// outputs 9, but i thought it should be 0, or undefined
Am I going about curly braces all wrong?
AS3: Reusable Blocks Or Actual Classes?
hi everybody.
for a long time, I've thought about using classes instead of writing my actionscript in the first frame of my .fla..
in example; recently. I've had to set up .flv-files to be shown on the internet, and this task is now kinda repetitive.
what I've done so far, is that I've copied these lines into the first frame of my new .fla-file:
Code:
var video:Video = new Video(640, 480);
addChild(video);
var videoConnection:NetConnection = new NetConnection();
videoConnection.connect(null);
var videoStream:NetStream = new NetStream(videoConnection);
var meta:Object = new Object();
meta.onMetaData = function(meta:Object){
trace(meta.duration);
}
videoStream.client = meta;
video.attachNetStream(videoStream);
this.setChildIndex(video, numChildren - 3);
pause_mc.addEventListener(MouseEvent.CLICK, pauseMe);
play_mc.addEventListener(MouseEvent.CLICK, resumeMe);
pause_mc.buttonMode = true;
play_mc.buttonMode = true;
function pauseMe(e:Event):void{
videoStream.pause();
}
function resumeMe(e:Event):void{
videoStream.resume();
}
videoStream.play("lilly.flv");
fairly nice and not overwhelming... (I think).
but still I have an idea, that I can optimize my work, by making classes of it. so I've tried to make the script above into classes (and man, it took me a long time!)
- .fla-file with DocumentClass: FLVPlayer
FLVPlayer.as:
Code:
package {
import CustomFLVPlayer;
import flash.display.Sprite;
public class FLVPlayer extends Sprite {
private var _customFLVPlayer:CustomFLVPlayer;
public function FLVPlayer() {
init();
}
private function init():void {
customFLVPlayerInit();
trace("Class FLVPlayer");
}
private function customFLVPlayerInit():void {
_customFLVPlayer = new CustomFLVPlayer();
addChild(_customFLVPlayer);
}
}
}
CustomFLVPlayer.as:
Code:
package{
import flash.display.Sprite;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.Event;
import flash.events.MouseEvent;
public class CustomFLVPlayer extends Sprite {
private var _video:Video;
private var _videoConnection:NetConnection;
private var _videoStream:NetStream;
private var _meta:Object;
private var _play:Play;
private var _pause:Pause;
public function CustomFLVPlayer() {
init();
}
private function init():void {
trace("Class CustomFLVPlayer");
customFLVPlayerInit();
customFLVPlayerControlsInit();
}
private function customFLVPlayerInit():void {
_video = new Video(640, 480);
addChild(_video);
_videoConnection = new NetConnection();
_videoConnection.connect(null);
_videoStream = new NetStream(_videoConnection);
_meta = new Object();
_meta.onMetaData = function(_meta:Object){
trace(_meta.duration);
}
_videoStream.client = _meta;
_video.attachNetStream(_videoStream);
_videoStream.play("lilly.flv");
}
private function customFLVPlayerControlsInit():void {
_play = new Play();
_pause = new Pause();
addChild(_play);
addChild(_pause);
_play.x = 20;
_pause.x = 35;
_play.y = 10;
_pause.y = 10;
_play.buttonMode = true;
_pause.buttonMode = true;
_pause.addEventListener(MouseEvent.CLICK, pauseMe);
_play.addEventListener(MouseEvent.CLICK, resumeMe);
}
private function pauseMe(e:Event){
_videoStream.pause();
}
private function resumeMe(e:Event){
_videoStream.resume();
}
}
}
(the Play and Pause are movieclips, I add into the Library of the new .fla-file)
at first, my way of copying the code into the new project still seems as the easiest way to do it.
but at the same time, I'm aware, that the way my classes are made, are not the proper or right way to make them.
so, questions that could help me on my way, by being answered, are:
- can I improve the recent class-setup?
- should I split my classes into more classes?
- how would these classes easily be used in future projects?
other comments or answers to answers to questions like the ones above, are very welcome.
and I hope, that it might help me getting the idea of classes
thanks
felisan
Embedding Specific Unicode Blocks
Hello all,
I did search around the actionscript.org forums and found a few threads detailing the same problem, but no solid fix. Here's my problem:
I need to embed a font in my .swf, so that when my application is used on different OS/browser combinations, the font will look consistent (it's a 'math pallette' application). Embedding a font in and of itself is no big deal, but there are a variety of problems. (Note also that I am not using any TextInput components, the app listens for the keyboard and creates static textfields for the characters on the fly (the reason for this is that other things can go in that involve drawing methods, such as fractions, roots, etc., which a standard TextInput will not handle).)
problem 1: we wanted to use Cambria Math, but Flash adds 15-20 px of white space to the north and south of all Cambria Math characters for some odd reason .. this is minor, we can pick a different font if Flash won't play nice with CM.
problem 2: bigger problem - when embedding a font, some of the higher unicode blocks are not available. I've read that Flash won't embed anything past the Latin blocks, but it is crucial that I have access to 'Letterlike Symbols' and 'Mathematical Operators', both higher blocks ...
problem 3: related to problem 2, I would like to only import the blocks (or even better, the characters) I need, rather than an entire font, as I would like for all of this to be carried around in one .swf - I am aware of the routine of embedding a font in a .swf, then loading that .swf at runtime to avoid bloating your main .swf.
I've seen people using the [Embed(source="blah.TTF", fontFamily="blah")], and have seen it claimed that one can restrict what blocks are imported with this syntax, but this does not appear to work in a regular AS3/Flash CS3 IDE setup, I've gotten the sense that the internal Embed tag is something only Flex gets to play with ...
any suggestions? Desperately looking for some solution before I put an image in the library for every single character I need and use those rather than static textfields.
Stop Motion Blocks GotoAndPlay
I think I found a bug in Flash. It spans from CS3 to MX and perhaps earlier.
I did a stop motion animation of me turning the pages of a scrap book (frames of a video recording). Then I put labels on each frame where a page is completely turned and did some actionscript (gotoAndPlay) so that I can choose from which page to start and to which page to arrive.
The problem is that gotoAndPlay does not actually go to the required frame. Instead it goes through all frames and only after that will the play head go to that frame. This only happens when images are used, when flash drawings are used, it will works just fine. And the weird thing is that when only the first half of the key frames between labeled frames are used, it works just fine.
I'm attaching the fla file (zipped, flash 08)
Here's how it works:
Layer 'code' contains actionscript and labels, layer 'animation' contains the stop motion pictures.
First frame of layer 'code' contains 2 variable initializations. currState holds the current page of the scrapbook and nextState holds the destination page (both zero based). There are 3 pages in all. A switch statement makes a gotoAndPlay to the required frame depending on currState (this is the part which doesn't work).
After the play head is on the frame with the start page, each labeled frame will contain actionscript to check if nextState matches the page on that frame and execute stop() if so.
I hope this is enough information to help you. If you need anything else just ask.
Move Blocks Of Frames On The Stage
Instead of creating another sequence of frames, I would like to copy and paste what is already created. However, I need them to be placed in a different location on the stage. Any takers?
Publish Issues And Email Blocks?
hey.
i have finally completed my flash portfolio. a portfolio that i intend to send my email to hopefuly get a job...soon. (-i obviously wont be a flash designer! haha.)
ok, 2 issues:
1. when i publish my flash to swf or projector (to the directory where i have my files organized) everything works fine. i guess the link are holding up.
however as soon as i relocate the swf or projector, some of my links (that reference XML files) do not work anymore!
-the file is already like 4 or 5 meg. would embedding or something help?
2. i really want this file to be convienant for the viewer. so, when i send the swf file, they must have flash. when i send the projector, some emails block the exe file. is the only way to zip it? what do you think?
-i hope someone can point me in the right direction.
-THANKS SO MUCH!!!!
Wmode Blocks Window.open
I need to have a flash swf that has the transperent wmode parameter (so I can have a
html div infront), and from that swf I need to be able to call a
javascript function that opens a new window without being blocked.
Creating the window.open based function and calling it from flash is no problem, and the popup opens fine in IE7, firefox3 and google crome, but the div with html is hidden.
As soon as I add the wmode parameter, I can see the div, but the popup is blocked in IE7. I have tried to use both swfobject1.5, swfobject2.0 and the standard html embed tag.
With best regards
Kristian Mørck
Flash Downloading Blocks Page Nav
I know my actionscript better than I know the browser environment, although I'm getting to grips with javascript because of the similarity. But some things like this are uncharted territory...
With a couple of flv players downloading some 3Mb and 7Mb flvs after the web page has rendered, the page nav in the containing page is blocked. So a click on a nav button (not flash) in the will result in a new page load, but it waits until what I assume is one of two simulaneous http connection slots are freed up. This can take a while depending on the user's connection speed and is unusual/unexpected/sub-standard behaviour for a web page. Having the two videos loading simultaneously is a requirement rather than sequencing the loads.
I know that browsers are limited to the number of simultaneous connections to a single domain for many reasons and that standards come into play. The flvs here are hosted at the same domain.
I've built optional delay flashvars for each player to permitting staggering them somewhat but that's a guess at best and won't solve the problem for everyone and could disadvantage some with very fast connections. I should mention that the target user is a business client so broadband users and the requirement is that the videos are ready to play asap.
I understand that placing the media in another domain is an option because the browser connections limit applies per domain. I also know you can change the settings for browsers to increase the connections per domain, but that's not helpful here... and that some browsers are less restrictive.
What I would like to know is:
Is there any simple way in flash to allow the regular html page nav to work as normal when flash has a stranglehold on the two simultaneous connections. Am I missing something obvious? TIA, GWD
Imported File Blocks Preloader
I got a preloader (the one by kirupa's tut) and put it in frame one of my movie, tested it and it works great!
Now i got the background of my site which i would like to be visible while preloading, its a 28K jpg file. The problem is that from the moment i put something which i imported (wether its a gif, jpg, wav or png doesn't matter) into frame 1 the preloader simply doesnt appear and jumps to frame 2 after preloading is done.
Can anyone help me out with this problem? Symbols created in flash don't block the preloader so i guess its got something to do with the imported objects in frame 1.
I already tried converting it to a symbol, include it in the preloader MC, nothing works
Dynamically Size 'grid Blocks'
Looking for some help with the logic and best suited solution to
populate 'grid block' sizes to their time slots from XML data into a
flash interface. Not only Text but also be able to dynamically size
the time slot ( for flash Channel Guide UI)of the tv show on the channel guide grid according to
its time.
Heres a Diagram. http://www.bivuac.com/ChGuide
So if ch 201 time slot for 9:00-10:00 PM was the Sopranos - I need to size the hour block on the grid with show name. The only things that will be constant are the Channels and Times. The XML files with the channel lineups will be updated every 3 days or so. -- so How do i dynamically size the grid blocks?
Please be patient with me.. I am project manager for a development team who is not familiar with this space.
Any help to this would be greatly appreciated.
|