View Full Version : Resizing border MClip to rezise VR view.
Hi,
Using the embed.fla as a starting point I've been playing.
One thing still stuck on is how to get flash to pick up things like which pano you are on...... surely a base requirement!? Any tips? (It's so frustrating seeing all that messaging in the output panel and wonder why one can not use that to trigger a function? Have I missed something?
I did succeed in making a button that increases the border (loader) MC (and toggles to original size. This looked lovely and worked a treat using listeners.
However after 'finishing it' I noticed that if I used the VR, panning and tilting around and then used the button, the size the border (loader) would go to would be different each time.
Been wondering why? Guess that the pan and tilt in the pano.swf must trick flash into thinking it's a different size or something.
So any ideas?
Regards
PS. I know one would use the expander, but I'm making an all in one product that does not use the VR window on it's own.
Steve
zleifr
05-22-2008, 07:26 PM
I am sure I know the answers, but I don't understand the questions. Can you go over the questions again.
Zepyr
Sorry if it was long winded, but all I wanted to do was resize the window of the loader MC.
I can't using a script that goes on values, because the loader MC goes to different sizes. (ie 900 width in script can be full width one time, then half the next - it depends on the pan, tilt and zoom of the pano.swf in the loader.
And if you do know the answer then could you answer the one that questioned how can I detect a loaded pano in my own flash file so that I can change a map.
Thanks.
zleifr
05-23-2008, 09:57 PM
I am still not quite sure what you mean by detect a loaded pano. Do you mean the name of the pano or that a pano has finished loading or something else entirely.
panorama.pano.panoName is the address of the panoname
panorama.pano.percentLoaded might work if you want to know when it has loaded, also panorama.pano.parsed might work.
I still don't know what you mean by resize the window of the loader MC. MovieClips are Loaders and Movieclips don't have windows....
Maybe this is what you are looking for:
panorama.setArea(0,0,stage.stageWidth,stage.stageH eight);
That will set the area of the MC that contains the panorama to the size of the stage. And you can use it in conjunction with a resize event to adjust the size if the user changes the size of the window.
Zephyr
Thanks, zleifr.
Yes that's what I wanted to know. How to address which pano I was on, and maybe the other part about size will work rather than the resizing loader MC which I was trying to get working - I have not tested your method yet.
Sorry for my lack of specifics, I'm a tinkerer until it works kind of person; who resorts to manuals when needed (RTFM) however in this case there's not much to go on, so it's testing.
Plus the project has to be finished in two days, and I've only just started to use AS3 - which has a number of changes to get used to, some of which I now have working.
I very much appreciate your help.
Cheers
Steve
OKay, Okay, it might be the late nights, it might be I'm stupid, but when I put any code like
trace("PanoName: "+panorama.pano.PanoName);
How come I get nothing back other than an error:
ReferenceError: Error #1069: Property PanoName not found on CubePanorama and there is no default value.
Apologies in advance if I am being incredibly stupid.
Regards
Steve
cheathamlane
05-25-2008, 01:00 AM
Can you post an FLA? Or (use the "code" tags!) post some of your ActionScript?
Hi, after googling 'code tags' here's the button script:
var flipflop = "0";
addEventListener(MouseEvent.CLICK, slidein2);
function slidein2(e:Event) {
if (flipflop=="1") {
flipflop="0";
} else {
flipflop="1";
}
addEventListener(Event.ENTER_FRAME, slide2);
}
function slide2(e:Event):void {
if (flipflop=="0") {
parent.loader.height += (420 - parent.loader.height)/2;
parent.loader.width += (550 - parent.loader.width)/2;
if (parent.loader.width <=551) {
removeEventListener(Event.ENTER_FRAME, slide2);
}
} else {
parent.loader.height += (610 - parent.loader.height)/2;
parent.loader.width += (960 - parent.loader.width)/2;
if (parent.loader.width >=959) {
removeEventListener(Event.ENTER_FRAME, slide2);
trace("width: "+parent.loader.width);
trace("height: "+parent.loader.height);
}
}
}
I'm not sure how good this is program wise - you could probably teach me better and have it all done in a few lines, I think it at least makes logic sense. It does work on so far that this script placed on a button in the embed.fla makes the loader (the container of pano0.swf) change size. However once a user moves the pan and tilt the actual real size seen with your eyes varies wildly. I've traced the values, and they stay correct - and move to the same size defined in the tween formulas.
I had high hopes for the panorama.pano.panoName being the answer to my requirement to pick up when the panorama point changes. However I can not get any fla file to even get
trace("panoname: "+panorama.pano.panoName")
to return anything other than unknown, undefined, as if it does not exist.
I have a feeling that the problem exists because all the handling resides in the pano0.swf and this is not accessible from any fla we write to contain it in, as in the embed.swf example. I hope I am wrong and there is a method, and it's my lack of knowledge preventing it all from working together.
Thanks for your points and I'll try and improve my posting question style. I have a hope that at least other newbies might find this verbose post helpful, as sometimes Newbies (as I am myself sometimes) find short hand posts and answers hard to follow on occasion as so much knowledge is assumed.
Regards
By the way if anyone wants to see some fun, then take out the remove enterframe listener, and it'll show the pano area changing as you pan and tilt around....... bit like being drunk?
Also. I am using the embed.fla example, where all panos are loaded via the xml loadPano(mynameofcubefaces) via the xml hotspot.
A different approach would be to have separate swf files, each loading one set of faces each to make one pano each and then an application swf that explicitly loads in just one of those swf at a time. I'd then have to handle the changes of the swf and hopefully be able to manage the changes for the application interfaces. I've not tried this and hope that hotspots could load in each of the swf at a time in this manner.
I'm not sure which is the correct method or tested the second, but I had gone with the first where all stuff pano was done via the xml hotspot definition and hoped to have just the one application swf file.
Regards
Steve
I get the same effect of the size of VR window actually seen is different from the values using the panorama.setArea method, as I had done just targeting the loader MC (which the pano loaded into in the embed.fla example)
zleifr
05-25-2008, 03:59 PM
Hi Steve,
This post might be helpful re: finding the current panoName:
http://flashpanoramas.com/forum/showthread.php?t=1178
Using panorama.pano.panoName has worked for me before unless I am crazy, but you do have to time it right. There is another way to do this, that might be simpler: register your embedPano parent swf with FPP as a plugin so that that it can receive notification each time a loadPano command is executed because once registered as a plugin, FPP will call a function called newPano in your parent swf each time that happens. Here is the thread:
http://flashpanoramas.com/forum/showthread.php?t=1138
(It is a long thread and there is a lot of confusion in there. The key thing to do is to copy the basic functions and variable that are required in a function into the parent embedPano.fla file, and make one change, switching the standard plugin init function for this:
function init (panoMain:Object=null) {
panorama.addExternal(this);
}
Then each time the pano changes, the newPano function will be called by FPP.
Zephyr
Hi Z
I hope you are not crazy, but yet to find the solution, so I really appreciate the hints on those posts. I'll take a look at them.
Timing!!! Flash - arrrrghh. Spent many an hour shuffling code until things do what ya think.
I hope you are not crazy and that the panorama.pano.panoName works. I noticed that it's defined in parameters of the xml........ but checking around that didn't help me. Hey if I find the answer I will post it up!!
Otherwise, I'm off to look at those posts. At least I might be learning something along the way.
Cheers
Steve
zleifr
05-25-2008, 06:25 PM
Hi Steve,
Try this, it might work:
panorama.panoParamters.panoname
Zephyr
Ah I was just about to post saying no it didn't work, when I noticed your post has parameters spelt wrong (and I had copied and pasted it - doh - lazy bones) so I corrected it and tried again............AND IT WORKED, GREAT ! WOW ! FANTASTIC ! BRILLIANT ! SUPERB ! :D :D :D :D Many, many thanks. Working on a bank holiday will not be so bad.
Thanks for the other method tips, it's at least started to increase my knowledge about how to use the register and custom swf's to maybe achieve something - although I'd not got register fully working before reading your post with the answer here.
(Funnily enough I had tried panorama.parameters.PanoName in a guessing session! desperate that I was.)
By the way it is vital that the Capital is correct in the code so just to clarify the working script is:
trace("PName: "+panorama.panoParameters.panoname)
Thanks once again Zephyr
I'm not complaining, but I still have not sorted the resizing of the MC loader with consistent results. I'm so happy that the main mapping, etc will work and the resize can be a future feature.
I just thought I'd post this so that anyone following could see that part was not resolved - at least in this post.
Cheers
vBulletin® v3.7.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.